]> sigrok.org Git - pulseview.git/commitdiff
LogicSignal: Check the TRIGGER_MATCH key before listing
authorJoel Holdsworth <redacted>
Sat, 17 Jan 2015 15:04:57 +0000 (15:04 +0000)
committerUwe Hermann <redacted>
Tue, 27 Jan 2015 15:28:30 +0000 (16:28 +0100)
pv/view/logicsignal.cpp

index 3bd885970413716f0989f9749d1f0e82e316efb0..c6b7cffa361253495c2a2d7c541de7920660a292 100644 (file)
@@ -316,14 +316,22 @@ void LogicSignal::init_trigger_actions(QWidget *parent)
 
 const vector<int32_t> LogicSignal::get_trigger_types() const
 {
-       try {
-               const Glib::VariantContainerBase gvar =
-                       device_->config_list(ConfigKey::TRIGGER_MATCH);
-               return Glib::VariantBase::cast_dynamic<
-                       Glib::Variant<vector<int32_t>>>(gvar).get();
-       } catch (Error e) {
-               return vector<int32_t>();
+       const auto keys = device_->config_keys(ConfigKey::DEVICE_OPTIONS);
+       const auto iter = keys.find(ConfigKey::TRIGGER_MATCH);
+       if (iter != keys.end() &&
+               (*iter).second.find(sigrok::LIST) != (*iter).second.end()) {
+               try {
+                       const Glib::VariantContainerBase gvar =
+                               device_->config_list(ConfigKey::TRIGGER_MATCH);
+                       return Glib::VariantBase::cast_dynamic<
+                               Glib::Variant<vector<int32_t>>>(gvar).get();
+               } catch (Error e) {
+                       // Failed to enumerate triggers
+                       (void)e;
+               }
        }
+
+       return vector<int32_t>();
 }
 
 QAction* LogicSignal::action_from_trigger_type(const TriggerMatchType *type)