Skip to content

Commit d6ed444

Browse files
committed
Add null check in new -game fallback
1 parent 567084a commit d6ed444

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

Diff for: loader/loader.cpp

+13-10
Original file line numberDiff line numberDiff line change
@@ -224,17 +224,20 @@ mm_GetGameName(char *buffer, size_t size)
224224
// we can't even set MM:S path with GameBin instead of Game, the first Game path will always be MM:S's
225225
// location, rather than the real Game dir
226226
char *pszAppId = std::getenv("SteamAppId");
227-
switch (strtoul(pszAppId, nullptr, 10))
227+
if (pszAppId)
228228
{
229-
case 570ul:
230-
strncpy(buffer, "dota", size);
231-
break;
232-
case 730ul:
233-
strncpy(buffer, "csgo", size);
234-
break;
235-
case 1422450ul:
236-
strncpy(buffer, "citadel", size);
237-
break;
229+
switch (strtoul(pszAppId, nullptr, 10))
230+
{
231+
case 570ul:
232+
strncpy(buffer, "dota", size);
233+
break;
234+
case 730ul:
235+
strncpy(buffer, "csgo", size);
236+
break;
237+
case 1422450ul:
238+
strncpy(buffer, "citadel", size);
239+
break;
240+
}
238241
}
239242
}
240243

0 commit comments

Comments
 (0)