eeschema: Testing for static/dynamic cast failure

This commit is contained in:
Seth Hillbrand 2019-10-17 21:29:26 -07:00
parent 132adf8ac3
commit 92011d91d2
2 changed files with 5 additions and 2 deletions

View File

@ -902,6 +902,9 @@ int SCH_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
{ {
SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( item ); SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( item );
if( !sch_item )
continue;
if( sch_item->Type() == SCH_JUNCTION_T ) if( sch_item->Type() == SCH_JUNCTION_T )
{ {
sch_item->SetFlags( STRUCT_DELETED ); sch_item->SetFlags( STRUCT_DELETED );

View File

@ -866,10 +866,10 @@ int SCH_LINE_WIRE_BUS_TOOL::AddJunctionsIfNeeded( const TOOL_EVENT& aEvent )
for( unsigned ii = 0; ii < aSelection->GetSize(); ii++ ) for( unsigned ii = 0; ii < aSelection->GetSize(); ii++ )
{ {
SCH_ITEM* item = static_cast<SCH_ITEM*>( aSelection->GetItem( ii ) ); SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( aSelection->GetItem( ii ) );
std::vector<wxPoint> new_pts; std::vector<wxPoint> new_pts;
if( !item->IsConnectable() ) if( !item || !item->IsConnectable() )
continue; continue;
item->GetConnectionPoints( new_pts ); item->GetConnectionPoints( new_pts );