From 4f1592e5c1b417acafcd5292cdd1c2647e5b075a Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Sat, 13 Feb 2021 06:41:10 -0800 Subject: [PATCH] Fix crash with empty undo stack --- eeschema/schematic_undo_redo.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/eeschema/schematic_undo_redo.cpp b/eeschema/schematic_undo_redo.cpp index b7967eeadb..9dca9cfd45 100644 --- a/eeschema/schematic_undo_redo.cpp +++ b/eeschema/schematic_undo_redo.cpp @@ -117,10 +117,13 @@ void SCH_EDIT_FRAME::SaveCopyInUndoList( SCH_SCREEN* aScreen, PICKED_ITEMS_LIST* lastUndo = PopCommandFromUndoList(); // If the last stack was empty, use that one instead of creating a new stack - if( aAppend || !lastUndo->GetCount() ) - commandToUndo = lastUndo; - else - PushCommandToUndoList( lastUndo ); + if( lastUndo ) + { + if( aAppend || !lastUndo->GetCount() ) + commandToUndo = lastUndo; + else + PushCommandToUndoList( lastUndo ); + } if( !commandToUndo ) {