FS-6290 --resolve

This commit is contained in:
Peter Olsson 2014-03-01 10:02:45 +01:00
parent ef278822d4
commit 8b57411bdd
5 changed files with 11 additions and 15 deletions

View File

@ -179,11 +179,6 @@ static switch_status_t v8_mod_load_file(const char *filename)
v8_mod_init = (v8_mod_init_t) (intptr_t) function_handle;
if (v8_mod_init == NULL) {
err = "Cannot Load";
goto err;
}
if (v8_mod_init(&module_interface) != SWITCH_STATUS_SUCCESS) {
err = "Module load routine returned an error";
goto err;

View File

@ -101,13 +101,14 @@ void *FSCoreDB::Construct(const v8::FunctionCallbackInfo<Value>& info)
int FSCoreDB::Callback(void *pArg, int argc, char **argv, char **columnNames)
{
FSCoreDB *dbo = static_cast<FSCoreDB *>(pArg);
HandleScope handle_scope(dbo->GetIsolate());
int x = 0;
if (!dbo) {
return 0;
}
HandleScope handle_scope(dbo->GetIsolate());
if (dbo->_callback.IsEmpty()) {
dbo->GetIsolate()->ThrowException(String::NewFromUtf8(dbo->GetIsolate(), "No callback specified"));
return 0;

View File

@ -60,7 +60,6 @@ string FSCURL::GetJSClassName()
size_t FSCURL::FileCallback(void *ptr, size_t size, size_t nmemb, void *data)
{
FSCURL *obj = static_cast<FSCURL *>(data);
HandleScope handle_scope(obj->GetIsolate());
register unsigned int realsize = (unsigned int) (size * nmemb);
uint32_t argc = 0;
Handle<Value> argv[4];
@ -69,6 +68,7 @@ size_t FSCURL::FileCallback(void *ptr, size_t size, size_t nmemb, void *data)
return 0;
}
HandleScope handle_scope(obj->GetIsolate());
Handle<Function> func;
if (!obj->_function.IsEmpty()) {

View File

@ -694,6 +694,10 @@ JS_SESSION_FUNCTION_IMPL(SayPhrase)
bool FSSession::CheckHangupHook(FSSession *obj, bool *ret)
{
if (!obj) {
return true;
}
Isolate *isolate = obj->GetIsolate();
HandleScope handle_scope(isolate);
Handle<Value> argv[2];
@ -701,7 +705,7 @@ bool FSSession::CheckHangupHook(FSSession *obj, bool *ret)
bool res = true;
string resp;
if (obj && !obj->_check_state && !obj->_on_hangup.IsEmpty() && (obj->_hook_state == CS_HANGUP || obj->_hook_state == CS_ROUTING)) {
if (!obj->_check_state && !obj->_on_hangup.IsEmpty() && (obj->_hook_state == CS_HANGUP || obj->_hook_state == CS_ROUTING)) {
obj->_check_state++;
argv[argc++] = Local<Object>::New(obj->GetOwner()->GetIsolate(), obj->GetJavaScriptObject());
@ -1499,18 +1503,14 @@ JS_SESSION_GET_PROPERTY_IMPL(GetProperty)
if (!strcmp(prop, "cause")) {
if (channel) {
info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), switch_channel_cause2str(switch_channel_get_cause(channel))));
} else if (this) {
info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), switch_channel_cause2str(this->_cause)));
} else {
info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), ""));
info.GetReturnValue().Set(String::NewFromUtf8(info.GetIsolate(), switch_channel_cause2str(this->_cause)));
}
} else if (!strcmp(prop, "causecode")) {
if (channel) {
info.GetReturnValue().Set(Integer::New(info.GetIsolate(), switch_channel_get_cause(channel)));
} else if (this) {
info.GetReturnValue().Set(Integer::New(info.GetIsolate(), this->_cause));
} else {
info.GetReturnValue().Set(Integer::New(info.GetIsolate(), 0));
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)));

View File

@ -304,7 +304,7 @@ JS_TELETONE_FUNCTION_IMPL(Generate)
break;
}
}
if ((write_frame.datalen = (uint32_t) switch_buffer_read_loop(_audio_buffer,
if (!_audio_buffer || (write_frame.datalen = (uint32_t) switch_buffer_read_loop(_audio_buffer,
fdata, write_frame.codec->implementation->decoded_bytes_per_packet)) <= 0) {
break;
}