From: Bert Vermeulen Date: Mon, 15 Apr 2013 16:45:38 +0000 (+0200) Subject: rigol-ds1xx2: Don't assume there's a valid sdi X-Git-Tag: dsupstream~147 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=a7be14ada20d594c5338613a73788e8f89c0d9d5;p=libsigrok.git rigol-ds1xx2: Don't assume there's a valid sdi --- diff --git a/hardware/rigol-ds1xx2/api.c b/hardware/rigol-ds1xx2/api.c index 5e4198ce..595d73e6 100644 --- a/hardware/rigol-ds1xx2/api.c +++ b/hardware/rigol-ds1xx2/api.c @@ -501,7 +501,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi) GVariant *tuple, *rational[2]; GVariantBuilder gvb; unsigned int i; - struct dev_context *devc = sdi->priv; + struct dev_context *devc; switch (key) { case SR_CONF_DEVICE_OPTIONS: @@ -532,6 +532,10 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi) *data = g_variant_builder_end(&gvb); break; case SR_CONF_TRIGGER_SOURCE: + if (!sdi || !sdi->priv) + /* Can't know this until we have the exact model. */ + return SR_ERR_ARG; + devc = sdi->priv; *data = g_variant_new_strv(trigger_sources, devc->has_digital ? ARRAY_SIZE(trigger_sources) : 4); break;