Don't try to copy a null item.

Fixes: lp:1836126
* https://bugs.launchpad.net/kicad/+bug/1836126
This commit is contained in:
Jeff Young 2019-07-11 18:23:11 +01:00
parent 6c9e34e799
commit 34894acb89
2 changed files with 8 additions and 5 deletions

View File

@ -359,11 +359,14 @@ void SCH_EDIT_FRAME::SaveCopyForRepeatItem( SCH_ITEM* aItem )
// that item may be deleted, such as part of a line concatenation or other.
// So simply always keep a copy of the object which is to be repeated.
delete m_item_to_repeat;
if( aItem )
{
delete m_item_to_repeat;
m_item_to_repeat = (SCH_ITEM*) aItem->Clone();
// Clone() preserves the flags, we want 'em cleared.
m_item_to_repeat->ClearFlags();
m_item_to_repeat = (SCH_ITEM*) aItem->Clone();
// Clone() preserves the flags, we want 'em cleared.
m_item_to_repeat->ClearFlags();
}
}

View File

@ -797,7 +797,7 @@ void SCH_LINE_WIRE_BUS_TOOL::finishSegments()
}
// Get the last non-null wire (this is the last created segment).
m_frame->SaveCopyForRepeatItem( s_wires.GetLast());
m_frame->SaveCopyForRepeatItem( s_wires.GetLast() );
// Add the new wires
while( s_wires.GetFirst() )