summaryrefslogtreecommitdiff
path: root/Lib/javascript/v8/javascriptrun.swg
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/javascript/v8/javascriptrun.swg')
-rw-r--r--Lib/javascript/v8/javascriptrun.swg12
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/javascript/v8/javascriptrun.swg b/Lib/javascript/v8/javascriptrun.swg
index 2e0a46717..f200f1520 100644
--- a/Lib/javascript/v8/javascriptrun.swg
+++ b/Lib/javascript/v8/javascriptrun.swg
@@ -220,7 +220,11 @@ void SWIGV8_SetPrivateData(v8::Handle<v8::Object> obj, void* ptr, swig_type_info
int SWIG_V8_ConvertPtr(v8::Handle<v8::Value> valRef, void** ptr, swig_type_info *info, int flags) {
v8::HandleScope scope;
-
+ /* special case: JavaScript null => C NULL pointer */
+ if(valRef->IsNull()) {
+ *ptr=0;
+ return SWIG_OK;
+ }
if(!valRef->IsObject()) {
return SWIG_TypeError;
}
@@ -228,10 +232,14 @@ int SWIG_V8_ConvertPtr(v8::Handle<v8::Value> valRef, void** ptr, swig_type_info
return SWIG_V8_ConvertInstancePtr(objRef, ptr, info, flags);
}
-v8::Handle<v8::Object> SWIG_V8_NewPointerObj(void *ptr, swig_type_info *info, int flags) {
+v8::Handle<v8::Value> SWIG_V8_NewPointerObj(void *ptr, swig_type_info *info, int flags) {
v8::HandleScope scope;
v8::Handle<v8::FunctionTemplate> class_templ;
+ if (ptr == NULL) {
+ return scope.Close(v8::Null());
+ }
+
#if (SWIG_V8_VERSION < 0x031900)
if(info->clientdata != 0) {
class_templ = ((SWIGV8_ClientData*) info->clientdata)->class_templ;