]> git.saurik.com Git - cycript.git/commitdiff
Fixed [Array objectAtIndex: > .length] to return nil.
authorJay Freeman (saurik) <saurik@saurik.com>
Sun, 18 Oct 2009 05:57:27 +0000 (05:57 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Sun, 18 Oct 2009 05:57:27 +0000 (05:57 +0000)
Library.mm

index 6537ffdbb10b54c340e26bc830d8702751b1eb9c..c8a2a6733d75922c0ba2de239c76f60b0fc25663 100644 (file)
@@ -1470,6 +1470,8 @@ bool CYIsCallable(JSContextRef context, JSValueRef value) {
 }
 
 - (id) objectAtIndex:(NSUInteger)index {
+    if (index >= CYCastDouble(context_, CYGetProperty(context_, object_, length_)))
+        return nil;
     JSValueRef exception(NULL);
     JSValueRef value(JSObjectGetPropertyAtIndex(context_, object_, index, &exception));
     CYThrow(context_, exception);