Merge pull request #4501 from def-/pr-crash

Fix crash in GetSaves (fixes #4500)
This commit is contained in:
Dennis Felsing 2021-12-21 00:14:46 +01:00 committed by GitHub
commit 0073f6ce89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1641,11 +1641,11 @@ bool CScoreWorker::GetSaves(IDbConnection *pSqlServer, const ISqlData *pGameData
if(!End)
{
int NumSaves = pSqlServer->GetInt(1);
int Ago = pSqlServer->GetInt(2);
char aAgoString[40] = "\0";
char aLastSavedString[60] = "\0";
if(Ago)
if(!pSqlServer->IsNull(2))
{
int Ago = pSqlServer->GetInt(2);
char aAgoString[40] = "\0";
sqlstr::AgoTimeToString(Ago, aAgoString, sizeof(aAgoString));
str_format(aLastSavedString, sizeof(aLastSavedString), ", last saved %s ago", aAgoString);
}