Fix crash on invalid Editor.geometry (#1897)

alut-include-path
Lukas Werling 2017-03-10 22:02:32 +01:00
parent 10ab981b6f
commit 2c3a770415
1 changed files with 14 additions and 6 deletions

View File

@ -171,6 +171,8 @@ void C4ConsoleQtMainWindow::LoadGeometry()
// Restore window settings from file
StdBuf ws_contents;
if (ws_contents.LoadFromFile(Config.AtUserDataPath(C4CFN_EditorGeometry)))
{
try
{
EditorWindowState ws;
CompileFromBuf<StdCompilerBinRead>(ws, ws_contents);
@ -179,6 +181,12 @@ void C4ConsoleQtMainWindow::LoadGeometry()
restoreGeometry(geometry);
restoreState(window_state);
}
catch (StdCompiler::Exception *e)
{
Log("Editor: Could not restore window settings");
delete e;
}
}
}
void C4ConsoleQtMainWindow::PlayPressed(bool down)