]> sigrok.org Git - libsigrok.git/commitdiff
hantek-6xxx: sdi might be NULL - don't assign devc until !sdi is checked.
authorSebastian Zagrodzki <redacted>
Fri, 19 Aug 2016 13:22:35 +0000 (15:22 +0200)
committerUwe Hermann <redacted>
Sun, 21 Aug 2016 16:54:09 +0000 (18:54 +0200)
src/hardware/hantek-6xxx/api.c

index c3f3d881fd970f2ecff220e088252c224d4a1b37..57f5a28db4ace9176a9e13a412bd0b8556c7454f 100644 (file)
@@ -467,8 +467,6 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
        GVariant *gvar;
        struct dev_context *devc;
 
-       devc = sdi->priv;
-
        if (key == SR_CONF_SCAN_OPTIONS) {
                *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
                        scanopts, ARRAY_SIZE(scanopts), sizeof(uint32_t));
@@ -482,6 +480,8 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
        if (!sdi)
                return SR_ERR_ARG;
 
+       devc = sdi->priv;
+
        if (!cg) {
                switch (key) {
                case SR_CONF_DEVICE_OPTIONS: