From 73cf5081d01e2c28bb74eb02ff57b0849019574b Mon Sep 17 00:00:00 2001 From: Evangelos Ribeiro Tzaras Date: Wed, 15 Dec 2021 20:00:53 +0100 Subject: [PATCH] sip: origin: Prevent dialing when not online Setting up the nua context could have failed (see #379) and in that case our nua_*() calls might derefence a NULL pointer. --- plugins/sip/calls-sip-origin.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/sip/calls-sip-origin.c b/plugins/sip/calls-sip-origin.c index b8b515a..e315bf8 100644 --- a/plugins/sip/calls-sip-origin.c +++ b/plugins/sip/calls-sip-origin.c @@ -282,6 +282,12 @@ dial (CallsOrigin *origin, return; } + if (calls_account_get_state (CALLS_ACCOUNT (origin)) != CALLS_ACCOUNT_ONLINE) { + g_warning ("Tried dialing on origin '%s', but it's not online", + name); + return; + } + self = CALLS_SIP_ORIGIN (origin); nh = nua_handle (self->nua, self->oper,