Remove unnecessary nesting

ini_importer_tests
elsid 12 months ago
parent 55501a02c0
commit fffc6101b7
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625

@ -341,8 +341,6 @@ static void crash_handler(const char* logfile)
fprintf(stderr, "Address: %p\n", crash_info.siginfo->si_addr); fprintf(stderr, "Address: %p\n", crash_info.siginfo->si_addr);
fputc('\n', stderr); fputc('\n', stderr);
if (logfile)
{
/* Create crash log file and redirect shell output to it */ /* Create crash log file and redirect shell output to it */
if (freopen(logfile, "wa", stdout) != stdout) if (freopen(logfile, "wa", stdout) != stdout)
{ {
@ -359,7 +357,6 @@ static void crash_handler(const char* logfile)
printf("Address: %p\n", crash_info.siginfo->si_addr); printf("Address: %p\n", crash_info.siginfo->si_addr);
fputc('\n', stdout); fputc('\n', stdout);
fflush(stdout); fflush(stdout);
}
sys_info(); sys_info();
@ -376,12 +373,9 @@ static void crash_handler(const char* logfile)
// even faulty applications shouldn't be able to freeze the X server. // even faulty applications shouldn't be able to freeze the X server.
usleep(100000); usleep(100000);
if (logfile) const std::string message = "OpenMW has encountered a fatal error.\nCrash log saved to '" + std::string(logfile)
{
std::string message = "OpenMW has encountered a fatal error.\nCrash log saved to '" + std::string(logfile)
+ "'.\n Please report this to https://gitlab.com/OpenMW/openmw/issues !"; + "'.\n Please report this to https://gitlab.com/OpenMW/openmw/issues !";
SDL_ShowSimpleMessageBox(0, "Fatal Error", message.c_str(), nullptr); SDL_ShowSimpleMessageBox(0, "Fatal Error", message.c_str(), nullptr);
}
exit(0); exit(0);
} }
@ -509,15 +503,15 @@ void crashCatcherInstall(int argc, char** argv, const std::filesystem::path& cra
{ {
#if (defined(__APPLE__) || (defined(__linux) && !defined(ANDROID)) || (defined(__unix) && !defined(ANDROID)) \ #if (defined(__APPLE__) || (defined(__linux) && !defined(ANDROID)) || (defined(__unix) && !defined(ANDROID)) \
|| defined(__posix)) || defined(__posix))
if ((argc == 2 && strcmp(argv[1], crash_switch) == 0) || !is_debugger_present())
{
if (argc == 2 && strcmp(argv[1], crash_switch) == 0) if (argc == 2 && strcmp(argv[1], crash_switch) == 0)
crash_handler(Files::pathToUnicodeString(crashLogPath).c_str()); crash_handler(Files::pathToUnicodeString(crashLogPath).c_str());
if (is_debugger_present())
return;
if (crashCatcherInstallHandlers(argv) == -1) if (crashCatcherInstallHandlers(argv) == -1)
Log(Debug::Warning) << "Installing crash handler failed"; Log(Debug::Warning) << "Installing crash handler failed";
else else
Log(Debug::Info) << "Crash handler installed"; Log(Debug::Info) << "Crash handler installed";
}
#endif #endif
} }

Loading…
Cancel
Save