]> sigrok.org Git - libsigrok.git/commitdiff
rigol-ds1xx2: Don't assume there's a valid sdi
authorBert Vermeulen <redacted>
Mon, 15 Apr 2013 16:45:38 +0000 (18:45 +0200)
committerBert Vermeulen <redacted>
Mon, 15 Apr 2013 16:45:38 +0000 (18:45 +0200)
hardware/rigol-ds1xx2/api.c

index 5e4198ce16483ac1fd7ac026dd03c19df5693113..595d73e63778ad3b791e6545fe5d24944dbf934c 100644 (file)
@@ -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;