From 6b9c82c97590f05a9dc7c53f5c788e9cfeb860d9 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 4 Dec 2022 21:06:16 +0100 Subject: [PATCH] eeschema: fix a crash when converting a old .sch file containing global labels. --- eeschema/sch_sheet_path.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/eeschema/sch_sheet_path.cpp b/eeschema/sch_sheet_path.cpp index 84186f346a..fc778c3f50 100644 --- a/eeschema/sch_sheet_path.cpp +++ b/eeschema/sch_sheet_path.cpp @@ -346,10 +346,14 @@ void SCH_SHEET_PATH::UpdateAllScreenReferences() const else if( item->Type() == SCH_GLOBAL_LABEL_T ) { SCH_GLOBALLABEL* label = static_cast( item ); - SCH_FIELD& intersheetRefs = label->GetFields()[0]; - intersheetRefs.SetVisible( label->Schematic()->Settings().m_IntersheetRefsShow ); - LastScreen()->Update( &intersheetRefs ); + if( label->GetFields().size() > 0 ) // Can be not the case when reading a old .sch schematic + { + SCH_FIELD& intersheetRefs = label->GetFields()[0]; + + intersheetRefs.SetVisible( label->Schematic()->Settings().m_IntersheetRefsShow ); + LastScreen()->Update( &intersheetRefs ); + } } } }