From 39e316828e360d0ec95d5325807fee9801c393e3 Mon Sep 17 00:00:00 2001 From: Misa Date: Mon, 15 Feb 2021 18:38:42 -0800 Subject: [PATCH] Add NULL guards to Game::savestats() and savesettings() This is so those functions can safely be called when graphics.screenbuffer is NULL. --- desktop_version/src/Game.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index c2564b4c..07f44e96 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -4708,6 +4708,11 @@ void Game::deserializesettings(tinyxml2::XMLElement* dataNode, ScreenSettings* s bool Game::savestats() { + if (graphics.screenbuffer == NULL) + { + return false; + } + ScreenSettings screen_settings; graphics.screenbuffer->GetSettings(&screen_settings); @@ -4950,6 +4955,11 @@ void Game::loadsettings(ScreenSettings* screen_settings) bool Game::savesettings() { + if (graphics.screenbuffer == NULL) + { + return false; + } + ScreenSettings screen_settings; graphics.screenbuffer->GetSettings(&screen_settings);