From 61e19a3237fef83dbb1434769cde51a886d11667 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Sat, 18 Feb 2017 23:41:52 -0500 Subject: [PATCH] fix crash when undoing if there were no snapshots --- src/gui/game/GameController.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/game/GameController.cpp b/src/gui/game/GameController.cpp index 25ec67582..a0f7ee4fb 100644 --- a/src/gui/game/GameController.cpp +++ b/src/gui/game/GameController.cpp @@ -233,6 +233,8 @@ GameController::~GameController() void GameController::HistoryRestore() { std::deque history = gameModel->GetHistory(); + if (!history.size()) + return; unsigned int historyPosition = gameModel->GetHistoryPosition(); unsigned int newHistoryPosition = std::max((int)historyPosition-1, 0); // When undoing, save the current state as a final redo