7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-18 16:39:17 +00:00

Catch JSON errors when migrating

Any parsing of the json files can throw, so be sure we are catching the
errors and not crashing

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18655
This commit is contained in:
Seth Hillbrand 2024-09-06 09:29:50 -07:00
parent 3cb9dcb52b
commit 89849ccff1

View File

@ -89,7 +89,18 @@ bool NESTED_SETTINGS::LoadFromFile( const wxString& aDirectory )
wxLogTrace( traceSettings, wxT( "%s: attempting migration from version %d to %d" ),
m_filename, filever, m_schemaVersion );
if( !Migrate() )
bool migrated = false;
try
{
migrated = Migrate();
}
catch( ... )
{
success = false;
}
if( !migrated )
{
wxLogTrace( traceSettings, wxT( "%s: migration failed!" ), GetFullFilename() );
success = false;