From: Jay Freeman (saurik) Date: Sun, 18 Oct 2009 05:57:27 +0000 (+0000) Subject: Fixed [Array objectAtIndex: > .length] to return nil. X-Git-Tag: v0.9.432~328 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/859d21554b2786170506367b4b6218008a58191a Fixed [Array objectAtIndex: > .length] to return nil. --- diff --git a/Library.mm b/Library.mm index 6537ffd..c8a2a67 100644 --- a/Library.mm +++ b/Library.mm @@ -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);