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 ) {