Skip to content

Instantly share code, notes, and snippets.

@indutny
Created April 30, 2012 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save indutny/4e8b9a3c973e2ef41646 to your computer and use it in GitHub Desktop.
Save indutny/4e8b9a3c973e2ef41646 to your computer and use it in GitHub Desktop.
diff --git a/src/node_script.cc b/src/node_script.cc
index 0375fa4..988b41b 100644
--- a/src/node_script.cc
+++ b/src/node_script.cc
@@ -256,8 +256,8 @@ Handle<Value> WrappedScript::CreateContext(const Arguments& args) {
Local<Object> context = WrappedContext::NewInstance();
- if (args.Length() > 0) {
- Local<Object> sandbox = args[0]->ToObject();
+ if (args.Length() > 0 && args[0]->IsObject()) {
+ Local<Object> sandbox = args[0].As<Object>();
CloneObject(args.This(), sandbox, context);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment