diff --git a/components/crashcatcher/crashcatcher.cpp b/components/crashcatcher/crashcatcher.cpp index efdd7c254b..d2fad06c72 100644 --- a/components/crashcatcher/crashcatcher.cpp +++ b/components/crashcatcher/crashcatcher.cpp @@ -560,9 +560,6 @@ static bool is_debugger_present() void crashCatcherInstall(int argc, char **argv, const std::string &crashLogPath) { - if (const auto env = std::getenv("OPENMW_DISABLE_CRASH_CATCHER")) - if (std::atol(env) != 0) - return; if ((argc == 2 && strcmp(argv[1], crash_switch) == 0) || !is_debugger_present()) { int s[5] = { SIGSEGV, SIGILL, SIGFPE, SIGBUS, SIGABRT }; diff --git a/components/debug/debugging.cpp b/components/debug/debugging.cpp index 61de1ef4c1..e37406299d 100644 --- a/components/debug/debugging.cpp +++ b/components/debug/debugging.cpp @@ -314,16 +314,21 @@ int wrapApplication(int (*innerApplication)(int argc, char *argv[]), int argc, c setupLogging(cfgMgr.getLogPath().string(), appName, mode); } + if (const auto env = std::getenv("OPENMW_DISABLE_CRASH_CATCHER"); env == nullptr || std::atol(env) == 0) + { #if defined(_WIN32) - const std::string crashLogName = Misc::StringUtils::lowerCase(appName) + "-crash.dmp"; - Crash::CrashCatcher crashy(argc, argv, (cfgMgr.getLogPath() / crashLogName).make_preferred().string()); + const std::string crashLogName = Misc::StringUtils::lowerCase(appName) + "-crash.dmp"; + Crash::CrashCatcher crashy(argc, argv, (cfgMgr.getLogPath() / crashLogName).make_preferred().string()); #else - const std::string crashLogName = Misc::StringUtils::lowerCase(appName) + "-crash.log"; - // install the crash handler as soon as possible. note that the log path - // does not depend on config being read. - crashCatcherInstall(argc, argv, (cfgMgr.getLogPath() / crashLogName).string()); + const std::string crashLogName = Misc::StringUtils::lowerCase(appName) + "-crash.log"; + // install the crash handler as soon as possible. note that the log path + // does not depend on config being read. + crashCatcherInstall(argc, argv, (cfgMgr.getLogPath() / crashLogName).string()); #endif - ret = innerApplication(argc, argv); + ret = innerApplication(argc, argv); + } + else + ret = innerApplication(argc, argv); } catch (const std::exception& e) {