diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 794106bd13..5a56791468 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -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(); + } } diff --git a/eeschema/tools/sch_line_wire_bus_tool.cpp b/eeschema/tools/sch_line_wire_bus_tool.cpp index 3fb7ac4f0a..8b09507dc9 100644 --- a/eeschema/tools/sch_line_wire_bus_tool.cpp +++ b/eeschema/tools/sch_line_wire_bus_tool.cpp @@ -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() )