diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index 59ff39fab8..c512240a1a 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -902,6 +902,9 @@ int SCH_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent ) { SCH_ITEM* sch_item = dynamic_cast( item ); + if( !sch_item ) + continue; + if( sch_item->Type() == SCH_JUNCTION_T ) { sch_item->SetFlags( STRUCT_DELETED ); diff --git a/eeschema/tools/sch_line_wire_bus_tool.cpp b/eeschema/tools/sch_line_wire_bus_tool.cpp index f0f49f5a93..dc1a5d737b 100644 --- a/eeschema/tools/sch_line_wire_bus_tool.cpp +++ b/eeschema/tools/sch_line_wire_bus_tool.cpp @@ -866,10 +866,10 @@ int SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded( const TOOL_EVENT& aEvent ) for( unsigned ii = 0; ii < aSelection->GetSize(); ii++ ) { - SCH_ITEM* item = static_cast( aSelection->GetItem( ii ) ); + SCH_ITEM* item = dynamic_cast( aSelection->GetItem( ii ) ); std::vector new_pts; - if( !item->IsConnectable() ) + if( !item || !item->IsConnectable() ) continue; item->GetConnectionPoints( new_pts );