]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-6484: guess at fixing seg from mod_managed, this function should never be called...
authorMichael Jerris <mike@jerris.com>
Mon, 5 May 2014 23:18:58 +0000 (19:18 -0400)
committerMichael Jerris <mike@jerris.com>
Mon, 5 May 2014 23:19:03 +0000 (19:19 -0400)
src/switch_cpp.cpp

index 7e78f738049ec11df12a6be992e22753abacdc83..f0bb64f53be77a5ccf925cde37544ab85dbe862b 100644 (file)
@@ -1348,19 +1348,24 @@ SWITCH_DECLARE(void) bridge(CoreSession &session_a, CoreSession &session_b)
 
 SWITCH_DECLARE_NONSTD(switch_status_t) hanguphook(switch_core_session_t *session_hungup) 
 {
-       switch_channel_t *channel = switch_core_session_get_channel(session_hungup);
-       CoreSession *coresession = NULL;
-       switch_channel_state_t state = switch_channel_get_state(channel);
-
-       if ((coresession = (CoreSession *) switch_channel_get_private(channel, "CoreSession"))) {
-               if (coresession->hook_state != state) {
-                       coresession->cause = switch_channel_get_cause(channel);
-                       coresession->hook_state = state;
-                       coresession->check_hangup_hook();
+       if (session_hungup) {
+               switch_channel_t *channel = switch_core_session_get_channel(session_hungup);
+               CoreSession *coresession = NULL;
+               switch_channel_state_t state = switch_channel_get_state(channel);
+
+               if ((coresession = (CoreSession *) switch_channel_get_private(channel, "CoreSession"))) {
+                       if (coresession->hook_state != state) {
+                               coresession->cause = switch_channel_get_cause(channel);
+                               coresession->hook_state = state;
+                               coresession->check_hangup_hook();
+                       }
                }
-       }
 
-       return SWITCH_STATUS_SUCCESS;
+               return SWITCH_STATUS_SUCCESS;
+       } else {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "hangup hook called with null session, something is horribly wrong\n");
+               return SWITCH_STATUS_FALSE;
+       }
 }