diff --git a/docs/changelog.txt b/docs/changelog.txt index bd1b97e6e..c36597047 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -36,6 +36,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## New Plugins ## Fixes +- Fix crash for some players when they launch DF outside of the Steam client ## Misc Improvements diff --git a/library/modules/DFSteam.cpp b/library/modules/DFSteam.cpp index 289c22e27..1fd064d56 100644 --- a/library/modules/DFSteam.cpp +++ b/library/modules/DFSteam.cpp @@ -52,6 +52,12 @@ static void bind_all(color_ostream& out, DFLibrary* handle) { } bool DFSteam::init(color_ostream& out) { + char *steam_client_launch = getenv("SteamClientLaunch"); + if (!steam_client_launch || strncmp(steam_client_launch, "1", 2) != 0) { + DEBUG(dfsteam, out).print("not launched from Steam client; not initializing steam\n"); + return false; + } + for (auto& lib_str : STEAM_LIBS) { if ((g_steam_handle = OpenPlugin(lib_str.c_str()))) break; @@ -168,11 +174,6 @@ void DFSteam::launchSteamDFHackIfNecessary(color_ostream& out) { return; } - if (strncmp(getenv("SteamClientLaunch"), "1", 2)) { - DEBUG(dfsteam, out).print("not launched from Steam client\n"); - return; - } - void* iSteamApps = g_SteamInternal_FindOrCreateUserInterface(g_SteamAPI_GetHSteamUser(), "STEAMAPPS_INTERFACE_VERSION008"); if (!iSteamApps) { DEBUG(dfsteam, out).print("cannot obtain iSteamApps interface\n");