From: Jay Freeman (saurik) Date: Tue, 29 Dec 2015 06:35:15 +0000 (-0800) Subject: Make Instance() consistent with "no nil Instance". X-Git-Tag: v0.9.590~128 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/25677fbce0d6e85d955c0fffb58daaef81eab1d4?ds=inline Make Instance() consistent with "no nil Instance". --- 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 {