From 39d9aba57650cebf3d09f70ad2fed4deaa6611f4 Mon Sep 17 00:00:00 2001 From: JamesJCode <13408010-JamesJCode@users.noreply.gitlab.com> Date: Sun, 5 May 2024 14:22:42 +0100 Subject: [PATCH] Don't stop migrating JSON_SETTINGS if intermediate migrator missing --- common/settings/json_settings.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/common/settings/json_settings.cpp b/common/settings/json_settings.cpp index 5ee7e6e7eb..30fd2c7c34 100644 --- a/common/settings/json_settings.cpp +++ b/common/settings/json_settings.cpp @@ -678,23 +678,25 @@ bool JSON_SETTINGS::Migrate() { wxLogTrace( traceSettings, wxT( "Migrator missing for %s version %d!" ), typeid( *this ).name(), filever ); - return false; - } - - std::pair> pair = m_migrators.at( filever ); - - if( pair.second() ) - { - wxLogTrace( traceSettings, wxT( "Migrated %s from %d to %d" ), typeid( *this ).name(), - filever, pair.first ); - filever = pair.first; - m_internals->At( "meta.version" ) = filever; + filever++; } else { - wxLogTrace( traceSettings, wxT( "Migration failed for %s from %d to %d" ), - typeid( *this ).name(), filever, pair.first ); - return false; + std::pair> pair = m_migrators.at( filever ); + + if( pair.second() ) + { + wxLogTrace( traceSettings, wxT( "Migrated %s from %d to %d" ), + typeid( *this ).name(), filever, pair.first ); + filever = pair.first; + m_internals->At( "meta.version" ) = filever; + } + else + { + wxLogTrace( traceSettings, wxT( "Migration failed for %s from %d to %d" ), + typeid( *this ).name(), filever, pair.first ); + return false; + } } }