From: Christian Schmidt Date: Wed, 5 Dec 2018 21:10:25 +0000 (+0100) Subject: FS-11552: [mod_v8] Crash when accessing props of dead session X-Git-Tag: v1.8.5~1^2~14^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e7c63eec0c4a66741f5035efba47260b8caf05a8;p=thirdparty%2Ffreeswitch.git FS-11552: [mod_v8] Crash when accessing props of dead session --- diff --git a/src/mod/languages/mod_v8/src/fssession.cpp b/src/mod/languages/mod_v8/src/fssession.cpp index a34406a493..c8a315ced0 100644 --- a/src/mod/languages/mod_v8/src/fssession.cpp +++ b/src/mod/languages/mod_v8/src/fssession.cpp @@ -1530,11 +1530,23 @@ JS_SESSION_GET_PROPERTY_IMPL(GetProperty) info.GetReturnValue().Set(Integer::New(info.GetIsolate(), this->_cause)); } } else if (!strcmp(prop, "name")) { - info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), switch_channel_get_name(channel))); + if (channel) { + info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), switch_channel_get_name(channel))); + } else { + info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), "")); + } } else if (!strcmp(prop, "uuid")) { - info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), switch_channel_get_uuid(channel))); + if (channel) { + info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), switch_channel_get_uuid(channel))); + } else { + info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), "")); + } } else if (!strcmp(prop, "state")) { - info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), switch_channel_state_name(switch_channel_get_state(channel)))); + if (channel) { + info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), switch_channel_state_name(switch_channel_get_state(channel)))); + } else { + info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), "")); + } } else if (!strcmp(prop, "dialplan")) { if (caller_profile) { info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), caller_profile->dialplan));