Reputation: 5301
I am building node addon with node 0.10.17
and in one of my class i am making a context of v8. I have this code :
v8::Locker locker;
v8::HandleScope handle_scope;
v8::Handle<v8::ObjectTemplate> globalTemplate;
// vvv--------------- Exception here at ->Set()
globalTemplate->Set(v8::String::New("version"), v8::FunctionTemplate::New(NodeVersion));
context = v8::Context::New(NULL, globalTemplate);
if (context.IsEmpty()) {
fprintf(stderr, "Error creating context\n");
}
This is giving me exception in ->Set()
function call.
The application is just breaking.
What should i do ?
Upvotes: 1
Views: 174
Reputation: 1821
Your globalTemplate
pointer is null, since you only created a null v8::Handle.
You should do something like this:
v8::Handle<v8::ObjectTemplate> globalTemplate = v8::ObjectTemplate::New();
Upvotes: 1