From: Sebastian Zagrodzki Date: Fri, 19 Aug 2016 13:22:35 +0000 (+0200) Subject: hantek-6xxx: sdi might be NULL - don't assign devc until !sdi is checked. X-Git-Tag: libsigrok-0.5.0~278 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=7f46b27ef2cefa9baf1ef8fdcf547451e85dc702;p=libsigrok.git hantek-6xxx: sdi might be NULL - don't assign devc until !sdi is checked. --- diff --git a/src/hardware/hantek-6xxx/api.c b/src/hardware/hantek-6xxx/api.c index c3f3d881..57f5a28d 100644 --- a/src/hardware/hantek-6xxx/api.c +++ b/src/hardware/hantek-6xxx/api.c @@ -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: