Add null check to avoid sigsegv on shutdown

During shutdown, it's possible that msg task
is freed as part of shutdown before the objects
that can send messages to msg task are freed,
which can result in a sigsegv when messages are
sent during this time.

Change-Id: I8f9963de75b395ca6c9a3d484416c34682cd0821
CRs-fixed: 2300596
This commit is contained in:
Dante Russo 2018-08-22 17:30:33 -07:00
parent 27114f21cc
commit 5eff5e8ba2

View file

@ -74,10 +74,11 @@ void MsgTask::destroy() {
}
void MsgTask::sendMsg(const LocMsg* msg) const {
if (msg) {
if (msg && this) {
msg_q_snd((void*)mQ, (void*)msg, LocMsgDestroy);
} else {
LOC_LOGE("%s: msg is NULL", __func__);
LOC_LOGE("%s: msg is %p and this is %p",
__func__, msg, this);
}
}