]> sigrok.org Git - pulseview.git/commitdiff
SamplingBar: Handle a failure to list the LIMIT_SAMPLES key
authorJoel Holdsworth <redacted>
Mon, 5 Jan 2015 20:11:12 +0000 (20:11 +0000)
committerJoel Holdsworth <redacted>
Mon, 5 Jan 2015 20:13:54 +0000 (20:13 +0000)
pv/toolbars/samplingbar.cpp

index 8c1b3c6d17691a42a1ee4dd80cbbf7d23ae106b4..710f3128af727cf4ef51ce90178d6efaa94f3ab6 100644 (file)
@@ -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),