From b7b125d83c26b8e38a2380a8945d38fe1de9d9a8 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 3 Sep 2018 19:51:17 +0200 Subject: [PATCH] Eeschema: Fix incorrect parsing of old schematic files (version 2) for HLabels and GLabels --- eeschema/sch_legacy_plugin.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/eeschema/sch_legacy_plugin.cpp b/eeschema/sch_legacy_plugin.cpp index e76313f7c0..b56e1f7c72 100644 --- a/eeschema/sch_legacy_plugin.cpp +++ b/eeschema/sch_legacy_plugin.cpp @@ -1363,13 +1363,17 @@ SCH_TEXT* SCH_LEGACY_PLUGIN::loadText( FILE_LINE_READER& aReader ) int thickness = 0; - // The following tokens do not exist in version 1 schematic files. + // The following tokens do not exist in version 1 schematic files, + // and not always in version 2 for HLabels and GLabels if( m_version > 1 ) { - if( strCompare( "Italic", line, &line ) ) - text->SetItalic( true ); - else if( !strCompare( "~", line, &line ) ) - SCH_PARSE_ERROR( _( "expected 'Italics' or '~'" ), aReader, line ); + if( m_version > 2 || *line >= ' ' ) + { + if( strCompare( "Italic", line, &line ) ) + text->SetItalic( true ); + else if( !strCompare( "~", line, &line ) ) + SCH_PARSE_ERROR( _( "expected 'Italics' or '~'" ), aReader, line ); + } // The thickness token does not exist in older versions of the schematic file format // so calling parseInt will be made only if the EOL is not reached.