From 0df21916639c282fa85e6b6412b2958709bd5a4e Mon Sep 17 00:00:00 2001 From: Jon Evans <jon@craftyjon.com> Date: Sat, 7 Mar 2020 16:10:37 -0500 Subject: [PATCH] Fix missing changes from last commit --- 3d-viewer/3d_viewer/3d_viewer_settings.h | 8 ++------ include/settings/parameters.h | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/3d-viewer/3d_viewer/3d_viewer_settings.h b/3d-viewer/3d_viewer/3d_viewer_settings.h index a7126aa2fa..5f99bf0e16 100644 --- a/3d-viewer/3d_viewer/3d_viewer_settings.h +++ b/3d-viewer/3d_viewer/3d_viewer_settings.h @@ -89,12 +89,8 @@ public: COLOR4D val = m_default; - try - { - val = aSettings->Get<COLOR4D>( m_path ); - } - catch( ... ) - {} + if( OPT<COLOR4D> optval = aSettings->Get<COLOR4D>( m_path ) ) + val = *optval; *m_ptr = val; } diff --git a/include/settings/parameters.h b/include/settings/parameters.h index 224efe691c..026ed462bd 100644 --- a/include/settings/parameters.h +++ b/include/settings/parameters.h @@ -141,9 +141,15 @@ public: ValueType val = m_default; if( std::is_same<ValueType, nlohmann::json>::value ) - val = aSettings->GetJson( m_path ); + { + if( OPT<nlohmann::json> optval = aSettings->GetJson( m_path ) ) + val = *optval; + } else - val = aSettings->Get<ValueType>( m_path ); + { + if( OPT<ValueType> optval = aSettings->Get<ValueType>( m_path ) ) + val = *optval; + } m_setter( val ); } @@ -206,12 +212,8 @@ public: double dval = m_default * m_scale; - try - { - dval = aSettings->Get<double>( m_path ); - } - catch( ... ) - {} + if( OPT<double> optval = aSettings->Get<double>( m_path ) ) + dval = *optval; ValueType val = KiROUND<ValueType>( dval / m_scale );