Fix LoadGameConfigFile returning valid handle on invalid path

This commit is contained in:
Arkshine 2016-01-15 17:35:21 +01:00
parent f1a2a00d38
commit 33768740fa

View File

@ -24,6 +24,7 @@ static cell AMX_NATIVE_CALL LoadGameConfigFile(AMX *amx, cell *params)
if (!ConfigManager.LoadGameConfigFile(filename, &config, error, sizeof(error))) if (!ConfigManager.LoadGameConfigFile(filename, &config, error, sizeof(error)))
{ {
ConfigManager.CloseGameConfigFile(config);
LogError(amx, AMX_ERR_NATIVE, "Unable to open %s: %s", filename, error); LogError(amx, AMX_ERR_NATIVE, "Unable to open %s: %s", filename, error);
return 0; return 0;
} }
@ -31,7 +32,7 @@ static cell AMX_NATIVE_CALL LoadGameConfigFile(AMX *amx, cell *params)
int handle = GameConfigHandle.create(); int handle = GameConfigHandle.create();
auto configHandle = GameConfigHandle.lookup(handle); auto configHandle = GameConfigHandle.lookup(handle);
if (!configHandle) if (!configHandle)
{ {
return 0; return 0;