fix crash when undoing if there were no snapshots

This commit is contained in:
jacob1 2017-02-18 23:41:52 -05:00
parent 2967cde4c0
commit 61e19a3237

View File

@ -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