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 );