Fix crash bug when highlighting no net (found by Coverity).
This commit is contained in:
parent
bdada70ee7
commit
c82679a6f2
|
@ -714,10 +714,13 @@ static bool highlightNet( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition )
|
||||||
SCH_ITEM* item = static_cast<SCH_ITEM*>( selTool->GetNode( aPosition ) );
|
SCH_ITEM* item = static_cast<SCH_ITEM*>( selTool->GetNode( aPosition ) );
|
||||||
SCH_COMPONENT* comp = nullptr;
|
SCH_COMPONENT* comp = nullptr;
|
||||||
|
|
||||||
if( item->Type() == SCH_FIELD_T )
|
if( item )
|
||||||
comp = dynamic_cast<SCH_COMPONENT*>( item->GetParent() );
|
{
|
||||||
else
|
if( item->Type() == SCH_FIELD_T )
|
||||||
comp = dynamic_cast<SCH_COMPONENT*>( item );
|
comp = dynamic_cast<SCH_COMPONENT*>( item->GetParent() );
|
||||||
|
else
|
||||||
|
comp = dynamic_cast<SCH_COMPONENT*>( item );
|
||||||
|
}
|
||||||
|
|
||||||
if( comp && comp->GetPartRef() && comp->GetPartRef()->IsPower() )
|
if( comp && comp->GetPartRef() && comp->GetPartRef()->IsPower() )
|
||||||
netName = comp->GetPartRef()->GetName();
|
netName = comp->GetPartRef()->GetName();
|
||||||
|
|
Loading…
Reference in New Issue