]> git.saurik.com Git - cycript.git/commitdiff
Make Instance() consistent with "no nil Instance".
authorJay Freeman (saurik) <saurik@saurik.com>
Tue, 29 Dec 2015 06:35:15 +0000 (22:35 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Tue, 29 Dec 2015 06:35:15 +0000 (22:35 -0800)
ObjectiveC/Library.mm

index 0fb792a07bc812e79b213e056e2c7c4da3871751..b185bf705e6f99b20a6f297cc055d13f405beb7e 100644 (file)
@@ -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<id>(context, arguments[0]));
-    return CYMakeInstance(context, self);
+    return CYMakeInstance(context, CYCastPointer<id>(context, arguments[0]));
 } CYCatch(NULL) }
 
 static JSValueRef CYValue_getProperty_value(JSContextRef context, JSObjectRef object, JSStringRef property, JSValueRef *exception) { CYTry {