From e6843cde64287357ddc7e2ca8444f1470fcde7da Mon Sep 17 00:00:00 2001 From: Seth Hillbrand <seth@kipro-pcb.com> Date: Thu, 20 Mar 2025 13:11:08 -0700 Subject: [PATCH] Don't re-read tokens on error If the data were empty, there is no token, so curTok will represent the right paren, not the next token Fixes https://gitlab.com/kicad/code/kicad/-/issues/20301 (cherry picked from commit d2550138bc333ea9538109362c7975ae2da51898) --- common/embedded_files.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/embedded_files.cpp b/common/embedded_files.cpp index 9c8afe65dc..92ef040517 100644 --- a/common/embedded_files.cpp +++ b/common/embedded_files.cpp @@ -390,8 +390,10 @@ void EMBEDDED_FILES_PARSER::ParseEmbedded( EMBEDDED_FILES* aFiles ) catch( const PARSE_ERROR& e ) { // No data in the file -- due to bug in writer for 9.0.0 - NeedRIGHT(); - break; + if( curTok == T_RIGHT ) + break; + else + throw e; } catch( ... ) {