From: EJ Date: Sun, 17 Apr 2016 07:30:54 +0000 (+0200) Subject: Fix #786 by checking for opts in the bindings X-Git-Tag: libsigrok-0.5.0~522 X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=116670b15d1facd756cb97525b3fea51d11d28a4 Fix #786 by checking for opts in the bindings --- diff --git a/bindings/cxx/classes.cpp b/bindings/cxx/classes.cpp index f7b1dcba..cfc2dafb 100644 --- a/bindings/cxx/classes.cpp +++ b/bindings/cxx/classes.cpp @@ -434,9 +434,11 @@ set Driver::scan_options() const { GArray *opts = sr_driver_scan_options_list(_structure); set 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; }