From: Joel Holdsworth Date: Mon, 5 Jan 2015 20:11:12 +0000 (+0000) Subject: SamplingBar: Handle a failure to list the LIMIT_SAMPLES key X-Git-Tag: pulseview-0.3.0~277 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=6454b1e960c85b17ec9590b78bc0387dc348ae9b;p=pulseview.git SamplingBar: Handle a failure to list the LIMIT_SAMPLES key --- diff --git a/pv/toolbars/samplingbar.cpp b/pv/toolbars/samplingbar.cpp index 8c1b3c6d..710f3128 100644 --- a/pv/toolbars/samplingbar.cpp +++ b/pv/toolbars/samplingbar.cpp @@ -293,9 +293,16 @@ void SamplingBar::update_sample_count_selector() const auto iter = keys.find(ConfigKey::LIMIT_SAMPLES); if (iter != keys.end() && (*iter).second.find(sigrok::LIST) != (*iter).second.end()) { - auto gvar = device->config_list(ConfigKey::LIMIT_SAMPLES); - g_variant_get(gvar.gobj(), "(tt)", - &min_sample_count, &max_sample_count); + try { + auto gvar = + device->config_list(ConfigKey::LIMIT_SAMPLES); + if (gvar) + g_variant_get(gvar.gobj(), "(tt)", + &min_sample_count, &max_sample_count); + } catch(const sigrok::Error &e) { + // Failed to query sample limit + (void)e; + } } min_sample_count = min(max(min_sample_count, MinSampleCount),