Eeschema: fix a bug when reading .dcm files (the eol char was not stripped, giving broken fields values)

The parser also now skip empty lines.

This bug created unreadable saved .dcm files and .sch files after adding a new symbol.

Fixes: lp:1786141
https://bugs.launchpad.net/kicad/+bug/1786141
This commit is contained in:
jean-pierre charras 2018-08-09 08:44:10 +02:00
parent 42c5017db7
commit 45395f9b59
1 changed files with 6 additions and 0 deletions

View File

@ -2472,6 +2472,8 @@ void SCH_LEGACY_PLUGIN_CACHE::loadDocs()
break; break;
text = FROM_UTF8( line + 2 ); text = FROM_UTF8( line + 2 );
// Remove spaces at eol, and eol chars:
text = text.Trim();
switch( line[0] ) switch( line[0] )
{ {
@ -2490,7 +2492,11 @@ void SCH_LEGACY_PLUGIN_CACHE::loadDocs()
alias->SetDocFileName( text ); alias->SetDocFileName( text );
break; break;
case 0:
case '\n':
case '\r':
case '#': case '#':
// Empty line or commment
break; break;
default: default: