rigol-ds1xx2: Don't assume there's a valid sdi

This commit is contained in:
Bert Vermeulen 2013-04-15 18:45:38 +02:00
parent bf25678359
commit a7be14ada2
1 changed files with 5 additions and 1 deletions

View 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;