Skip to content

Commit 0ea8f14

Browse files
committed
Fix client crash when the server has deleted the asbi, energy_weapons, rd_first_person, or rd_third_person challenge definition files.
1 parent 5f0cb94 commit 0ea8f14

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/game/shared/swarm/rd_challenges_shared.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,20 @@ void ReactiveDropChallenges::ClearServerCache()
106106
}
107107

108108
// add some challenges to the top of the list (will be filled in during the loop)
109+
char szKVFileName[MAX_PATH];
109110
for ( int i = 0; i < NELEMS( s_szOfficialChallengesFirst ); i++ )
110111
{
111112
Assert( IsOfficial( s_szOfficialChallengesFirst[i] ) );
112-
g_StringTableReactiveDropChallenges->AddString( true, s_szOfficialChallengesFirst[i] );
113+
Q_snprintf( szKVFileName, sizeof( szKVFileName ), "resource/challenges/%s.txt", s_szOfficialChallengesFirst[i] );
114+
115+
// make sure we don't crash by saying we have a challenge but not actually having it
116+
if ( filesystem->FileExists( szKVFileName, "GAME" ) )
117+
{
118+
g_StringTableReactiveDropChallenges->AddString( true, s_szOfficialChallengesFirst[i] );
119+
}
113120
}
114121

115122
RD_Challenge_t summary;
116-
char szKVFileName[MAX_PATH];
117123
char szChallengeName[MAX_PATH];
118124
FileFindHandle_t hFind;
119125
for ( const char *pszChallenge = filesystem->FindFirstEx( "resource/challenges/*.txt", "GAME", &hFind ); pszChallenge; pszChallenge = filesystem->FindNext( hFind ) )

0 commit comments

Comments
 (0)