mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 18:23:15 +02:00
Don't write empty data tags
Also avoid throwing if a data stream is empty so that you can still read the schematic/pcb/library Fixes https://gitlab.com/kicad/code/kicad/-/issues/20301 (cherry picked from commit a6fbf4bbdbc7e08c815a4b28f14a99be48aee621)
This commit is contained in:
parent
631c5ec01d
commit
5d9908647c
@ -162,6 +162,13 @@ void EMBEDDED_FILES::WriteEmbeddedFiles( OUTPUTFORMATTER& aOut, bool aWriteData
|
|||||||
{
|
{
|
||||||
const EMBEDDED_FILE& file = *entry;
|
const EMBEDDED_FILE& file = *entry;
|
||||||
|
|
||||||
|
// Skip empty files
|
||||||
|
if( file.compressedEncodedData.empty() )
|
||||||
|
{
|
||||||
|
wxLogDebug( wxT( "Error: Embedded file '%s' is empty" ), file.name );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
aOut.Print( "(file " );
|
aOut.Print( "(file " );
|
||||||
aOut.Print( "(name %s)", aOut.Quotew( file.name ).c_str() );
|
aOut.Print( "(name %s)", aOut.Quotew( file.name ).c_str() );
|
||||||
|
|
||||||
@ -376,7 +383,21 @@ void EMBEDDED_FILES_PARSER::ParseEmbedded( EMBEDDED_FILES* aFiles )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case T_data:
|
case T_data:
|
||||||
|
try
|
||||||
|
{
|
||||||
NeedBAR();
|
NeedBAR();
|
||||||
|
}
|
||||||
|
catch( const PARSE_ERROR& e )
|
||||||
|
{
|
||||||
|
// No data in the file -- due to bug in writer for 9.0.0
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
catch( ... )
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
token = NextTok();
|
token = NextTok();
|
||||||
|
|
||||||
file->compressedEncodedData.reserve( 1 << 17 );
|
file->compressedEncodedData.reserve( 1 << 17 );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user