← Back to team overview

kicad-developers team mailing list archive

quick fix for legacy_plugin.cpp import of legacy sch files, Version: (2017-02-21 revision 8bed8af)-master, debug build

 

Bug:  importing legacy sch file's   fails  on global labels, because code
checks for "~" or "italics" on global
labels,  when they have no such option.

Fix bypass's check for global labels

Application: kicad
Version: (2017-02-21 revision 8bed8af)-master, debug build
Libraries: wxWidgets 3.0.2
           libcurl/7.38.0 OpenSSL/1.0.1t zlib/1.2.8 libidn/1.29
libssh2/1.4.3 librtmp/2.3
Platform: Linux 3.16.0-4-amd64 x86_64, 64 bit, Little endian, wxGTK
- Build Info -
wxWidgets: 3.0.2 (wchar_t,wx containers,compatible with 2.8)
Boost: 1.55.0
Curl: 7.38.0
KiCad - Compiler: GCC 4.8.4 with C++ ABI 1002
        Settings: USE_WX_GRAPHICS_CONTEXT=OFF
                  USE_WX_OVERLAY=OFF
                  KICAD_SCRIPTING=ON
                  KICAD_SCRIPTING_MODULES=OFF
                  KICAD_SCRIPTING_WXPYTHON=OFF
                  KICAD_SCRIPTING_ACTION_MENU=OFF
                  BUILD_GITHUB_PLUGIN=ON
                  KICAD_USE_OCE=OFF


Lachlan
diff --git a/eeschema/sch_legacy_plugin.cpp b/eeschema/sch_legacy_plugin.cpp
index fbf8df64..ddaced7 100644
--- a/eeschema/sch_legacy_plugin.cpp
+++ b/eeschema/sch_legacy_plugin.cpp
@@ -1248,7 +1248,7 @@ SCH_TEXT* SCH_LEGACY_PLUGIN::loadText( FILE_LINE_READER& aReader )
     int thickness = 0;
 
     // The following tokens do not exist in version 1 schematic files.
-    if( m_version > 1 )
+    if( m_version > 1 && ( text->Type() != SCH_HIERARCHICAL_LABEL_T ) && ( text->Type() != SCH_GLOBAL_LABEL_T ) )
     {
         if( strCompare( "Italic", line, &line ) )
             text->SetItalic( true );

Follow ups