]> sigrok.org Git - pulseview.git/commitdiff
Enum now allows the no-selection condition
authorJoel Holdsworth <redacted>
Sun, 7 Apr 2013 19:49:10 +0000 (20:49 +0100)
committerJoel Holdsworth <redacted>
Mon, 8 Apr 2013 18:08:18 +0000 (19:08 +0100)
pv/prop/enum.cpp

index 065fd548f22b336151d03da49f0c03e43456bce1..ced2f2bb0c79664b98af758a2ecf42b6d711316a 100644 (file)
@@ -51,13 +51,12 @@ QWidget* Enum::get_widget(QWidget *parent)
                return _selector;
 
        GVariant *const value = _getter ? _getter() : NULL;
-       assert(value);
 
        _selector = new QComboBox(parent);
        for (unsigned int i = 0; i < _values.size(); i++) {
                const pair<GVariant*, QString> &v = _values[i];
                _selector->addItem(v.second, qVariantFromValue((void*)v.first));
-               if (g_variant_compare(v.first, value) == 0)
+               if (value && g_variant_compare(v.first, value) == 0)
                        _selector->setCurrentIndex(i);
        }