]> sigrok.org Git - libsigrok.git/commitdiff
Fix #786 by checking for opts in the bindings
authorEJ <redacted>
Sun, 17 Apr 2016 07:30:54 +0000 (09:30 +0200)
committerSoeren Apel <redacted>
Sun, 17 Apr 2016 07:30:54 +0000 (09:30 +0200)
bindings/cxx/classes.cpp

index f7b1dcba112c7dbcc583d11c17d7775e55d513c1..cfc2dafbfa4b10d32cf5d6ac9ace9f395b0f4121 100644 (file)
@@ -434,9 +434,11 @@ set<const ConfigKey *> Driver::scan_options() const
 {
        GArray *opts = sr_driver_scan_options_list(_structure);
        set<const ConfigKey *> result;
-       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;
 }