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;
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];
return 0;
}
+ HandleScope handle_scope(obj->GetIsolate());
Handle<Function> func;
if (!obj->_function.IsEmpty()) {
bool FSSession::CheckHangupHook(FSSession *obj, bool *ret)
{
+ if (!obj) {
+ return true;
+ }
+
Isolate *isolate = obj->GetIsolate();
HandleScope handle_scope(isolate);
Handle<Value> argv[2];
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());
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)));