From: johanengelen Date: Fri, 23 Nov 2007 19:40:07 +0000 (+0000) Subject: Fix [ 1835591 ] Reproducible crash on opening the attached file X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a74f63f75615756c5eb31fffbee8c72face49895;p=inkscape.git Fix [ 1835591 ] Reproducible crash on opening the attached file --- diff --git a/src/ui/widget/registered-enums.h b/src/ui/widget/registered-enums.h index 6dfa48b7a..0a17aeca3 100644 --- a/src/ui/widget/registered-enums.h +++ b/src/ui/widget/registered-enums.h @@ -55,15 +55,23 @@ public: } void set_active_by_id (E id) { - combobox()->set_active_by_id(id); + ComboBoxEnum * cb = combobox(); + if (cb) + cb->set_active_by_id(id); }; void set_active_by_key (const Glib::ustring& key) { - combobox()->set_active_by_key(key); + ComboBoxEnum * cb = combobox(); + if (cb) + cb->set_active_by_key(key); } inline const Util::EnumData* get_active_data() { - return combobox()->get_active_data(); + ComboBoxEnum * cb = combobox(); + if (cb) + return cb->get_active_data(); + else + return NULL; } ComboBoxEnum * combobox() { diff --git a/src/ui/widget/registered-widget.cpp b/src/ui/widget/registered-widget.cpp index 804a403f6..1ee52cc99 100644 --- a/src/ui/widget/registered-widget.cpp +++ b/src/ui/widget/registered-widget.cpp @@ -221,16 +221,19 @@ RegisteredScalarUnit::getSU() void RegisteredScalarUnit::setValue (double val) { - _widget->setValue (val); + if (_widget) + _widget->setValue (val); } void RegisteredScalarUnit::on_value_changed() { +g_message("on_value_changed"); if (_widget->setProgrammatically) { _widget->setProgrammatically = false; return; } +g_message("on_value_changed1"); if (_wr->isUpdating()) return; @@ -284,7 +287,8 @@ RegisteredScalar::getS() void RegisteredScalar::setValue (double val) { - _widget->setValue (val); + if (_widget) + _widget->setValue (val); } void @@ -483,9 +487,15 @@ const Glib::ustring& key, Registry& wr, Inkscape::XML::Node* repr_in, SPDocument void RegisteredRadioButtonPair::setValue (bool second) { + if (!_rb1 || !_rb2) + return; + setProgrammatically = true; - if (second) _rb2->set_active(); - else _rb1->set_active(); + if (second) { + _rb2->set_active(); + } else { + _rb1->set_active(); + } } void @@ -549,7 +559,8 @@ RegisteredPoint::getPoint() void RegisteredPoint::setValue (double xval, double yval) { - _widget->setValue(xval, yval); + if (_widget) + _widget->setValue(xval, yval); } void @@ -615,6 +626,9 @@ RegisteredRandom::getR() void RegisteredRandom::setValue (double val, long startseed) { + if (!_widget) + return; + _widget->setValue (val); _widget->setStartSeed(startseed); }