From 1a8fcdfdd7f4ecdbf6db3929f9ddec4d3defff88 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Wed, 30 Aug 2023 14:31:12 -0400 Subject: [PATCH] Do not crash if PARAM_LIST backing data contains unexpected type --- common/settings/parameters.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/common/settings/parameters.cpp b/common/settings/parameters.cpp index 4a58c1edcf..8c21b45ab4 100644 --- a/common/settings/parameters.cpp +++ b/common/settings/parameters.cpp @@ -121,7 +121,16 @@ bool PARAM_LIST::MatchesFile( JSON_SETTINGS* aSettings ) const std::vector val; for( const auto& el : js->items() ) - val.emplace_back( el.value().get() ); + { + try + { + val.emplace_back( el.value().get() ); + } + catch( ... ) + { + // Probably typecast didn't work; skip this element + } + } return val == *m_ptr; }