Eeschema: fix a crash when loading a schematic if a symbol in a sheet has

a lib_name containing {slash} instead of /
(related to commits #2f51d22b and b2bf28f5)
Fixes #15791
https://gitlab.com/kicad/code/kicad/-/issues/15791
This commit is contained in:
jean-pierre charras 2023-10-01 09:56:22 +02:00
parent bbfe01d4c6
commit b227f9de61
1 changed files with 6 additions and 0 deletions

View File

@ -2682,6 +2682,11 @@ SCH_SYMBOL* SCH_SEXPR_PARSER::parseSchematicSymbol()
} }
libName = FromUTF8(); libName = FromUTF8();
// Some symbol LIB_IDs or lib_name have the '/' character escaped which can break
// symbol links. The '/' character is no longer an illegal LIB_ID character so
// it doesn't need to be escaped.
libName.Replace( "{slash}", "/" );
NeedRIGHT(); NeedRIGHT();
break; break;
} }
@ -2699,6 +2704,7 @@ SCH_SYMBOL* SCH_SEXPR_PARSER::parseSchematicSymbol()
// symbol links. The '/' character is no longer an illegal LIB_ID character so // symbol links. The '/' character is no longer an illegal LIB_ID character so
// it doesn't need to be escaped. // it doesn't need to be escaped.
name.Replace( "{slash}", "/" ); name.Replace( "{slash}", "/" );
int bad_pos = libId.Parse( name ); int bad_pos = libId.Parse( name );
if( bad_pos >= 0 ) if( bad_pos >= 0 )