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.
This commit is contained in:
Bert Vermeulen 2014-09-19 00:21:30 +02:00
parent 04c2f202f2
commit 79f92686c6
1 changed files with 5 additions and 0 deletions

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