From: Bert Vermeulen Date: Thu, 18 Sep 2014 22:21:30 +0000 (+0200) Subject: session: Don't try to send packets if no session has been set. X-Git-Tag: libsigrok-0.4.0~991 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=79f92686c620cfd06e3ed9fd1a20087343e4778a;p=libsigrok.git session: Don't try to send packets if no session has been set. This indicates a bug, but let's not segfault if it happens. --- diff --git a/src/session.c b/src/session.c index dc8fd4fb..f81aa332 100644 --- a/src/session.c +++ b/src/session.c @@ -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);