Fix crash with empty undo stack

This commit is contained in:
Seth Hillbrand 2021-02-13 06:41:10 -08:00
parent e06aa32780
commit 4f1592e5c1
1 changed files with 7 additions and 4 deletions

View File

@ -117,10 +117,13 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_SCREEN* aScreen,
PICKED_ITEMS_LIST* lastUndo = PopCommandFromUndoList(); PICKED_ITEMS_LIST* lastUndo = PopCommandFromUndoList();
// If the last stack was empty, use that one instead of creating a new stack // If the last stack was empty, use that one instead of creating a new stack
if( lastUndo )
{
if( aAppend || !lastUndo->GetCount() ) if( aAppend || !lastUndo->GetCount() )
commandToUndo = lastUndo; commandToUndo = lastUndo;
else else
PushCommandToUndoList( lastUndo ); PushCommandToUndoList( lastUndo );
}
if( !commandToUndo ) if( !commandToUndo )
{ {