Add some defensive code to prevent crash when no undo record is stacked.
Fixes: lp:1838843 * https://bugs.launchpad.net/kicad/+bug/1838843
This commit is contained in:
parent
5503727d3d
commit
b6b26b4e1e
|
@ -362,14 +362,17 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
|
|||
void SCH_EDIT_FRAME::RollbackSchematicFromUndo()
|
||||
{
|
||||
PICKED_ITEMS_LIST* undo = GetScreen()->PopCommandFromUndoList();
|
||||
PutDataInPreviousState( undo, false );
|
||||
|
||||
undo->ClearListAndDeleteItems();
|
||||
delete undo;
|
||||
if( undo )
|
||||
{
|
||||
PutDataInPreviousState( undo, false );
|
||||
undo->ClearListAndDeleteItems();
|
||||
delete undo;
|
||||
|
||||
SetSheetNumberAndCount();
|
||||
SetSheetNumberAndCount();
|
||||
|
||||
TestDanglingEnds();
|
||||
TestDanglingEnds();
|
||||
}
|
||||
|
||||
SyncView();
|
||||
GetCanvas()->Refresh();
|
||||
|
|
Loading…
Reference in New Issue