Fix compatibility with some old V4 schematic files.

From master branch, commit #bfe59581
This commit is contained in:
jean-pierre charras 2021-12-01 13:36:28 +01:00
parent 54c3031d74
commit 2758acfd42
1 changed files with 6 additions and 2 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016 CERN
* Copyright (C) 2016-2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Wayne Stambaugh <stambaughw@gmail.com>
*
@ -1112,9 +1112,13 @@ SCH_BITMAP* SCH_LEGACY_PLUGIN::loadBitmap( FILE_LINE_READER& aReader )
// Read PNG data, stored in hexadecimal,
// each byte = 2 hexadecimal digits and a space between 2 bytes
// and put it in memory stream buffer
// Note:
// Some old files created by the V4 schematic versions have a extra
// "$EndBitmap" at the end of the hexadecimal data. (Probably due to
// a bug). So discard it
int len = strlen( line );
for( ; len > 0 && !isspace( *line ); len -= 3, line += 3 )
for( ; len > 0 && !isspace( *line ) && '$' != *line; len -= 3, line += 3 )
{
int value = 0;