From ce237e4a743da1f12b85531b333350c2c8d5d92d Mon Sep 17 00:00:00 2001 From: James Turner Date: Wed, 28 Jul 2021 13:47:15 +0100 Subject: [PATCH] Explicit fatal error for bad_alloc Give the user some feedback if we're exiting due to out-of- memory condition. --- src/Main/bootstrap.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Main/bootstrap.cxx b/src/Main/bootstrap.cxx index 3230bd408..510a0ac27 100644 --- a/src/Main/bootstrap.cxx +++ b/src/Main/bootstrap.cxx @@ -337,6 +337,9 @@ int main ( int argc, char **argv ) info = std::string("received from ") + t.getOrigin(); flightgear::fatalMessageBoxWithoutExit( "Fatal exception", t.getFormattedMessage(), info); + } catch (const std::bad_alloc&) { + flightgear::fatalMessageBoxWithoutExit("Out of memory", + "FlightGear ran out of memory and must exit.", "Consider adjusting your settings or closing other applications."); } catch (const std::exception &e ) { flightgear::fatalMessageBoxWithoutExit("Fatal exception", e.what()); } catch (const std::string &s) {