[calls] sip: origin: Prevent dialing when not online



commit 73cf5081d01e2c28bb74eb02ff57b0849019574b
Author: Evangelos Ribeiro Tzaras <devrtz fortysixandtwo eu>
Date:   Wed Dec 15 20:00:53 2021 +0100

    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 b8b515ab..e315bf8f 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,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]