From: Joel Holdsworth Date: Mon, 5 Jan 2015 20:10:44 +0000 (+0000) Subject: SamplingBar: Handle a failure to list the SAMPLERATE key X-Git-Tag: pulseview-0.3.0~278 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=c2db8ec3890e004455a55a493968d02a24a97242;p=pulseview.git SamplingBar: Handle a failure to list the SAMPLERATE key This fixes #529 --- diff --git a/pv/toolbars/samplingbar.cpp b/pv/toolbars/samplingbar.cpp index 7ee4d981..8c1b3c6d 100644 --- a/pv/toolbars/samplingbar.cpp +++ b/pv/toolbars/samplingbar.cpp @@ -183,8 +183,17 @@ void SamplingBar::update_sample_rate_selector() const auto iter = keys.find(ConfigKey::SAMPLERATE); if (iter != keys.end() && (*iter).second.find(sigrok::LIST) != (*iter).second.end()) { - gvar_dict = device->config_list(ConfigKey::SAMPLERATE); - } else { + const auto keys = device->config_keys( + ConfigKey::DEVICE_OPTIONS); + try { + gvar_dict = device->config_list(ConfigKey::SAMPLERATE); + } catch(const sigrok::Error &e) { + // Failed to enunmerate samplerate + (void)e; + } + } + + if (!gvar_dict) { sample_rate_.show_none(); updating_sample_rate_ = false; return;