eeschema: fix a crash when converting a old .sch file containing global labels.

This commit is contained in:
jean-pierre charras 2022-12-04 21:06:16 +01:00
parent 6e1f075daa
commit 6b9c82c975
1 changed files with 7 additions and 3 deletions

View File

@ -346,10 +346,14 @@ void SCH_SHEET_PATH::UpdateAllScreenReferences() const
else if( item->Type() == SCH_GLOBAL_LABEL_T ) else if( item->Type() == SCH_GLOBAL_LABEL_T )
{ {
SCH_GLOBALLABEL* label = static_cast<SCH_GLOBALLABEL*>( item ); SCH_GLOBALLABEL* label = static_cast<SCH_GLOBALLABEL*>( item );
SCH_FIELD& intersheetRefs = label->GetFields()[0];
intersheetRefs.SetVisible( label->Schematic()->Settings().m_IntersheetRefsShow ); if( label->GetFields().size() > 0 ) // Can be not the case when reading a old .sch schematic
LastScreen()->Update( &intersheetRefs ); {
SCH_FIELD& intersheetRefs = label->GetFields()[0];
intersheetRefs.SetVisible( label->Schematic()->Settings().m_IntersheetRefsShow );
LastScreen()->Update( &intersheetRefs );
}
} }
} }
} }