Attempt reparse on stat failures and return BAD_HANDLE on error (#2253)

This commit is contained in:
Headline 2025-01-30 21:10:31 -08:00 committed by GitHub
parent 60d7f605cb
commit 9a03d1227f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -1174,7 +1174,7 @@ bool GameConfigManager::LoadGameConfigFile(const char *file, IGameConfig **_pCon
{ {
bool ret = true; bool ret = true;
time_t modtime = GetFileModTime(file); time_t modtime = GetFileModTime(file);
if (pConfig->m_ModTime != modtime) if (pConfig->m_ModTime != modtime || pConfig->m_ModTime == 0)
{ {
pConfig->m_ModTime = modtime; pConfig->m_ModTime = modtime;
ret = pConfig->Reparse(error, maxlength); ret = pConfig->Reparse(error, maxlength);

View File

@ -64,7 +64,7 @@ static cell_t smn_LoadGameConfigFile(IPluginContext *pCtx, const cell_t *params)
pCtx->LocalToString(params[1], &filename); pCtx->LocalToString(params[1], &filename);
if (!g_GameConfigs.LoadGameConfigFile(filename, &gc, error, sizeof(error))) if (!g_GameConfigs.LoadGameConfigFile(filename, &gc, error, sizeof(error)))
{ {
return pCtx->ThrowNativeError("Unable to open %s: %s", filename, error); return BAD_HANDLE;
} }
Handle_t hndl = handlesys->CreateHandle(g_GameConfigsType, gc, pCtx->GetIdentity(), g_pCoreIdent, NULL); Handle_t hndl = handlesys->CreateHandle(g_GameConfigsType, gc, pCtx->GetIdentity(), g_pCoreIdent, NULL);