diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index 10e2501d94..cf553bc945 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -714,10 +714,13 @@ static bool highlightNet( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition ) SCH_ITEM* item = static_cast( selTool->GetNode( aPosition ) ); SCH_COMPONENT* comp = nullptr; - if( item->Type() == SCH_FIELD_T ) - comp = dynamic_cast( item->GetParent() ); - else - comp = dynamic_cast( item ); + if( item ) + { + if( item->Type() == SCH_FIELD_T ) + comp = dynamic_cast( item->GetParent() ); + else + comp = dynamic_cast( item ); + } if( comp && comp->GetPartRef() && comp->GetPartRef()->IsPower() ) netName = comp->GetPartRef()->GetName();