From: Joel Holdsworth Date: Sat, 17 Jan 2015 15:04:57 +0000 (+0000) Subject: LogicSignal: Check the TRIGGER_MATCH key before listing X-Git-Tag: pulseview-0.3.0~256 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=08d9c3caec0a3ad1c624af685f948e17b91d278a;p=pulseview.git LogicSignal: Check the TRIGGER_MATCH key before listing --- diff --git a/pv/view/logicsignal.cpp b/pv/view/logicsignal.cpp index 3bd88597..c6b7cffa 100644 --- a/pv/view/logicsignal.cpp +++ b/pv/view/logicsignal.cpp @@ -316,14 +316,22 @@ void LogicSignal::init_trigger_actions(QWidget *parent) const vector LogicSignal::get_trigger_types() const { - try { - const Glib::VariantContainerBase gvar = - device_->config_list(ConfigKey::TRIGGER_MATCH); - return Glib::VariantBase::cast_dynamic< - Glib::Variant>>(gvar).get(); - } catch (Error e) { - return vector(); + 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>>(gvar).get(); + } catch (Error e) { + // Failed to enumerate triggers + (void)e; + } } + + return vector(); } QAction* LogicSignal::action_from_trigger_type(const TriggerMatchType *type)