diff --git a/src/edt/edt/edtRecentConfigurationPage.cc b/src/edt/edt/edtRecentConfigurationPage.cc index 554f85be0..ca17ad53b 100644 --- a/src/edt/edt/edtRecentConfigurationPage.cc +++ b/src/edt/edt/edtRecentConfigurationPage.cc @@ -27,6 +27,7 @@ #include "layLayerTreeModel.h" #include "dbLibraryManager.h" #include "dbLibrary.h" +#include "tlLog.h" #include #include @@ -89,16 +90,24 @@ RecentConfigurationPage::get_stored_values () const std::string serialized_list = dispatcher ()->config_get (m_recent_cfg_name); std::list > values; - tl::Extractor ex (serialized_list.c_str ()); - while (! ex.at_end ()) { - values.push_back (std::vector ()); - while (! ex.at_end () && ! ex.test (";")) { - values.back ().push_back (std::string ()); - ex.read_word_or_quoted (values.back ().back ()); - ex.test (","); + try { + + tl::Extractor ex (serialized_list.c_str ()); + while (! ex.at_end ()) { + + values.push_back (std::vector ()); + while (! ex.at_end () && ! ex.test (";")) { + values.back ().push_back (std::string ()); + ex.read_word_or_quoted (values.back ().back ()); + ex.test (","); + } + } + } catch (tl::Exception &ex) { + tl::error << tl::to_string (tr ("Error reading configuration item ")) << m_recent_cfg_name << ": " << ex.msg (); + values.clear (); } return values; @@ -158,7 +167,11 @@ RecentConfigurationPage::render_to (QTreeWidgetItem *item, int column, const std case RecentConfigurationPage::Bool: { bool f = false; - tl::from_string (values [column], f); + try { + tl::from_string (values [column], f); + } catch (tl::Exception &ex) { + tl::error << tl::to_string (tr ("Configuration error (ArrayFlag/Bool): ")) << ex.msg (); + } static QString checkmark = QString::fromUtf8 ("\xe2\x9c\x93"); item->setText (column, f ? checkmark : QString ()); // "checkmark" } @@ -167,7 +180,12 @@ RecentConfigurationPage::render_to (QTreeWidgetItem *item, int column, const std case RecentConfigurationPage::Layer: { int icon_size = mp_view->style ()->pixelMetric (QStyle::PM_ButtonIconSize); - lay::LayerPropertiesConstIterator l = lp_iter_from_string (mp_view, values [column]); + lay::LayerPropertiesConstIterator l; + try { + l = lp_iter_from_string (mp_view, values [column]); + } catch (tl::Exception &ex) { + tl::error << tl::to_string (tr ("Configuration error (Layer): ")) << ex.msg (); + } if (! l.is_null () && ! l.at_end ()) { item->setIcon (column, lay::LayerTreeModel::icon_for_layer (l, mp_view, icon_size, icon_size, 0, true)); item->setText (column, tl::to_qstring (values [column])); @@ -199,7 +217,11 @@ RecentConfigurationPage::render_to (QTreeWidgetItem *item, int column, const std int flag_column = 0; for (std::list::const_iterator c = m_cfg.begin (); c != m_cfg.end (); ++c, ++flag_column) { if (c->rendering == RecentConfigurationPage::ArrayFlag) { - tl::from_string (values [flag_column], is_array); + try { + tl::from_string (values [flag_column], is_array); + } catch (tl::Exception &ex) { + tl::error << tl::to_string (tr ("Configuration error (IntIfArray/DoubleIfArray): ")) << ex.msg (); + } break; } } @@ -254,7 +276,11 @@ RecentConfigurationPage::render_to (QTreeWidgetItem *item, int column, const std case RecentConfigurationPage::PCellParameters: { std::map pcp; - pcp = pcell_parameters_from_string (values [column]); + try { + pcp = pcell_parameters_from_string (values [column]); + } catch (tl::Exception &ex) { + tl::error << tl::to_string (tr ("Configuration error (PCellParameters): ")) << ex.msg (); + } std::string r; for (std::map::const_iterator p = pcp.begin (); p != pcp.end (); ++p) { if (p != pcp.begin ()) {