From 11312976fcb1ef9fe7e91791ab509e67c2004124 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Mon, 13 Jul 2020 16:09:44 -0400 Subject: [PATCH] Fall back to default settings when screenbuffer is not present --- desktop_version/src/Game.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 70c650d8..21f6a3d3 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -4652,7 +4652,15 @@ void Game::savestats() dataNode->LinkEndChild( msg ); int width, height; - graphics.screenbuffer->GetWindowSize(&width, &height); + if (graphics.screenbuffer != NULL) + { + graphics.screenbuffer->GetWindowSize(&width, &height); + } + else + { + width = 320; + height = 240; + } msg = doc.NewElement( "window_width" ); msg->LinkEndChild( doc.NewText( help.String(width).c_str())); dataNode->LinkEndChild( msg ); @@ -4730,8 +4738,17 @@ void Game::savestats() msg->LinkEndChild(doc.NewText(help.String((int) glitchrunnermode).c_str())); dataNode->LinkEndChild(msg); + int vsyncOption; msg = doc.NewElement("vsync"); - msg->LinkEndChild(doc.NewText(help.String((int) graphics.screenbuffer->vsync).c_str())); + if (graphics.screenbuffer != NULL) + { + vsyncOption = (int) graphics.screenbuffer->vsync; + } + else + { + vsyncOption = 0; + } + msg->LinkEndChild(doc.NewText(help.String(vsyncOption).c_str())); dataNode->LinkEndChild(msg); for (size_t i = 0; i < controllerButton_flip.size(); i += 1)