From: Soeren Apel Date: Tue, 26 Apr 2016 16:07:03 +0000 (+0200) Subject: Bindings: Check for empty opts also in Configurable::config_keys() X-Git-Tag: libsigrok-0.5.0~438 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=0221cbdde3db6f41fdfd9a483e721a6514ef7f8b;p=libsigrok.git Bindings: Check for empty opts also in Configurable::config_keys() --- diff --git a/bindings/cxx/classes.cpp b/bindings/cxx/classes.cpp index cfc2dafb..1c5b97b0 100644 --- a/bindings/cxx/classes.cpp +++ b/bindings/cxx/classes.cpp @@ -509,10 +509,11 @@ set 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; }