diff --git a/channels/chan_sip.c b/channels/chan_sip.c index dbf54639e5..97d5d2b198 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -15576,7 +15576,8 @@ static int sipsock_read(int *id, int fd, short events, void *ignore) append_history(p, "Rx", "%s / %s / %s", req.data, get_header(&req, "CSeq"), req.rlPart2); if (!lockretry) { - ast_log(LOG_ERROR, "We could NOT get the channel lock for %s! \n", S_OR(p->owner->name, "- no channel name ??? - ")); + if (p->owner) + ast_log(LOG_ERROR, "We could NOT get the channel lock for %s! \n", S_OR(p->owner->name, "- no channel name ??? - ")); ast_log(LOG_ERROR, "SIP transaction failed: %s \n", p->callid); if (req.method != SIP_ACK) transmit_response(p, "503 Server error", &req); /* We must respond according to RFC 3261 sec 12.2 */