From e82e4af48338d56d4e7cf4578506e3d206f78dab Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 31 May 2023 00:45:07 +0100 Subject: [PATCH] Don't double-up FUTURE_FORMAT_ERROR problem strings. Fixes https://gitlab.com/kicad/code/kicad/-/issues/14780 --- common/exceptions.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/common/exceptions.cpp b/common/exceptions.cpp index ca496edcb1..6446fc2361 100644 --- a/common/exceptions.cpp +++ b/common/exceptions.cpp @@ -120,10 +120,18 @@ FUTURE_FORMAT_ERROR::FUTURE_FORMAT_ERROR( const PARSE_ERROR& aParseError, const wxString& aRequiredVersion ) : PARSE_ERROR() { - init( aRequiredVersion ); + if( const FUTURE_FORMAT_ERROR* ffe = dynamic_cast( &aParseError ) ) + { + requiredVersion = ffe->requiredVersion; + problem = ffe->Problem(); + } + else + { + init( aRequiredVersion ); - if( !aParseError.Problem().IsEmpty() ) - problem += wxS( "\n\n" ) + _( "Full error text:" ) + wxS( "\n" ) + aParseError.Problem(); + if( !aParseError.Problem().IsEmpty() ) + problem += wxS( "\n\n" ) + _( "Full error text:" ) + wxS( "\n" ) + aParseError.Problem(); + } lineNumber = aParseError.lineNumber; byteIndex = aParseError.byteIndex;