]> sigrok.org Git - libsigrok.git/blobdiff - hardware/serial-dmm/api.c
serial-dmm: Fix segfault when no device is used
[libsigrok.git] / hardware / serial-dmm / api.c
index 8a2d7be2afac42b80fccd924d88801c2d3c56cd9..be240e236c79c38a134118076513a2d898cd7579 100644 (file)
@@ -151,6 +151,10 @@ static int clear_instances(void)
        struct dev_context *devc;
        GSList *l;
 
+       /* di is not necessarily initialized */
+       if (!di)
+               return SR_OK;
+
        if (!(drvc = di->priv))
                return SR_OK;