Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4c217e2

Browse files
committed
fix: crash on debugger
In debugger's context properties on node's global object cannot be read
1 parent 0da35be commit 4c217e2

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/api/dispatcher.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,11 @@ void Dispatcher::OnEvent(int object_id,
7777
v8::Integer::New(object_id), v8::String::New(event.c_str()), args };
7878

7979
// __nwObjectsRegistry.handleEvent(object_id, event, arguments);
80-
v8::Handle<v8::Object> objects_registry =
81-
node::g_context->Global()->Get(v8::String::New("__nwObjectsRegistry"))->
82-
ToObject();
80+
v8::Handle<v8::Value> val =
81+
node::g_context->Global()->Get(v8::String::New("__nwObjectsRegistry"));
82+
if (val->IsNull() || val->IsUndefined())
83+
return; // need to find out why it's undefined here in debugger
84+
v8::Handle<v8::Object> objects_registry = val->ToObject();
8385
node::MakeCallback(objects_registry, "handleEvent", 3, argv);
8486
}
8587

0 commit comments

Comments
 (0)