]> sigrok.org Git - libsigrok.git/commitdiff
Bindings: Check for empty opts also in Configurable::config_keys()
authorSoeren Apel <redacted>
Tue, 26 Apr 2016 16:07:03 +0000 (18:07 +0200)
committerUwe Hermann <redacted>
Mon, 9 May 2016 10:55:04 +0000 (12:55 +0200)
bindings/cxx/classes.cpp

index cfc2dafbfa4b10d32cf5d6ac9ace9f395b0f4121..1c5b97b0149de12dc832741de715cf0c9d7ad0fd 100644 (file)
@@ -509,10 +509,11 @@ set<const ConfigKey *> Configurable::config_keys() const
 
        opts = sr_dev_options(config_driver, config_sdi, config_channel_group);
 
-       for (guint i = 0; i < opts->len; i++)
-               result.insert(ConfigKey::get(g_array_index(opts, uint32_t, i)));
-
-       g_array_free(opts, TRUE);
+       if (opts) {
+               for (guint i = 0; i < opts->len; i++)
+                       result.insert(ConfigKey::get(g_array_index(opts, uint32_t, i)));
+               g_array_free(opts, TRUE);
+       }
 
        return result;
 }