From d6ed4443e86ab0e67d25fba1c2a7c0d8e6350040 Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Fri, 21 Feb 2025 08:11:13 -0500 Subject: [PATCH] Add null check in new -game fallback --- loader/loader.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/loader/loader.cpp b/loader/loader.cpp index 441cf24..5616171 100644 --- a/loader/loader.cpp +++ b/loader/loader.cpp @@ -224,17 +224,20 @@ mm_GetGameName(char *buffer, size_t size) // we can't even set MM:S path with GameBin instead of Game, the first Game path will always be MM:S's // location, rather than the real Game dir char *pszAppId = std::getenv("SteamAppId"); - switch (strtoul(pszAppId, nullptr, 10)) + if (pszAppId) { - case 570ul: - strncpy(buffer, "dota", size); - break; - case 730ul: - strncpy(buffer, "csgo", size); - break; - case 1422450ul: - strncpy(buffer, "citadel", size); - break; + switch (strtoul(pszAppId, nullptr, 10)) + { + case 570ul: + strncpy(buffer, "dota", size); + break; + case 730ul: + strncpy(buffer, "csgo", size); + break; + case 1422450ul: + strncpy(buffer, "citadel", size); + break; + } } }