From 25677fbce0d6e85d955c0fffb58daaef81eab1d4 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 28 Dec 2015 22:35:15 -0800 Subject: [PATCH] Make Instance() consistent with "no nil Instance". --- ObjectiveC/Library.mm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ObjectiveC/Library.mm b/ObjectiveC/Library.mm index 0fb792a..b185bf7 100644 --- a/ObjectiveC/Library.mm +++ b/ObjectiveC/Library.mm @@ -2541,10 +2541,9 @@ static JSObjectRef Selector_new(JSContextRef context, JSObjectRef object, size_t } CYCatch(NULL) } static JSObjectRef Instance_new(JSContextRef context, JSObjectRef object, size_t count, const JSValueRef arguments[], JSValueRef *exception) { CYTry { - if (count > 1) + if (count != 1) throw CYJSError(context, "incorrect number of arguments to Instance constructor"); - id self(count == 0 ? nil : CYCastPointer(context, arguments[0])); - return CYMakeInstance(context, self); + return CYMakeInstance(context, CYCastPointer(context, arguments[0])); } CYCatch(NULL) } static JSValueRef CYValue_getProperty_value(JSContextRef context, JSObjectRef object, JSStringRef property, JSValueRef *exception) { CYTry { -- 2.45.2