]> sigrok.org Git - libsigrok.git/commitdiff
session: Don't try to send packets if no session has been set.
authorBert Vermeulen <redacted>
Thu, 18 Sep 2014 22:21:30 +0000 (00:21 +0200)
committerBert Vermeulen <redacted>
Sun, 21 Sep 2014 22:47:22 +0000 (00:47 +0200)
This indicates a bug, but let's not segfault if it happens.

src/session.c

index dc8fd4fbeaffc2ce3c78cdeabcd5156f30c44363..f81aa3329afbbf76a8d59b82bfa25d70282de44e 100644 (file)
@@ -676,6 +676,11 @@ SR_PRIV int sr_session_send(const struct sr_dev_inst *sdi,
                return SR_ERR_ARG;
        }
 
+       if (!sdi->session) {
+               sr_err("%s: session was NULL", __func__);
+               return SR_ERR_BUG;
+       }
+
        for (l = sdi->session->datafeed_callbacks; l; l = l->next) {
                if (sr_log_loglevel_get() >= SR_LOG_DBG)
                        datafeed_dump(packet);