Fix crash in GetSaves (fixes #4500)

This commit is contained in:
def 2021-12-21 00:13:43 +01:00
parent fe0fb200a0
commit 2727c998c2

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);
}