mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-08 17:36:31 +02:00
fix crash when undoing if there were no snapshots
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user