Skip to content

Commit 740c942

Browse files
committed
fix bug when only 1 argument of invalid type was passed to interface ctor
1 parent 2120ff8 commit 740c942

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

runtime/src/main/jni/MetadataNode.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,11 @@ void MetadataNode::InterfaceConstructorCallback(const v8::FunctionCallbackInfo<v
986986

987987
if (info.Length() == 1)
988988
{
989+
if(!info[0]->IsObject())
990+
{
991+
throw NativeScriptException(string("You must provide an implementation object with overridden methods"));
992+
}
993+
989994
implementationObject = info[0]->ToObject();
990995
}
991996
else if (info.Length() == 2)
@@ -999,7 +1004,6 @@ void MetadataNode::InterfaceConstructorCallback(const v8::FunctionCallbackInfo<v
9991004
throw NativeScriptException(string("Second argument must be implementation object"));
10001005
}
10011006

1002-
DEBUG_WRITE("InterfaceConstructorCallback: getting extend name");
10031007
v8ExtendName = info[0]->ToString();
10041008
implementationObject = info[1]->ToObject();
10051009
}

0 commit comments

Comments
 (0)