Skip to content

Commit

Permalink
fix crash when undoing if there were no snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob1 committed Feb 19, 2017
1 parent 2967cde commit 61e19a3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/gui/game/GameController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ GameController::~GameController()
void GameController::HistoryRestore()
{
std::deque<Snapshot*> 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
Expand Down

0 comments on commit 61e19a3

Please sign in to comment.