]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/lecroy-xstream/api.c
lecroy-xstream: Properly handle a stopping acquisition
[libsigrok.git] / src / hardware / lecroy-xstream / api.c
index 533275a28882deeb7f2fd43e24def96a6a37ac6a..070ac7c13f7a4428afcb4c5199f60891da57302e 100644 (file)
@@ -360,6 +360,14 @@ SR_PRIV int lecroy_xstream_request_data(const struct sr_dev_inst *sdi)
        struct dev_context *devc;
 
        devc = sdi->priv;
+
+       /*
+        * We may be left with an invalid current_channel if acquisition was
+        * already stopped but we are processing the last pending events.
+        */
+       if (!devc->current_channel)
+               return SR_ERR_NA;
+
        ch = devc->current_channel->data;
 
        if (ch->type != SR_CHANNEL_ANALOG)