From 34894acb8906437228ca0325ce29f755a9e57c36 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 11 Jul 2019 18:23:11 +0100 Subject: [PATCH] Don't try to copy a null item. Fixes: lp:1836126 * https://bugs.launchpad.net/kicad/+bug/1836126 --- eeschema/sch_edit_frame.cpp | 11 +++++++---- eeschema/tools/sch_line_wire_bus_tool.cpp | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) 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() )