From 859d21554b2786170506367b4b6218008a58191a Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sun, 18 Oct 2009 05:57:27 +0000 Subject: [PATCH] Fixed [Array objectAtIndex: > .length] to return nil. --- Library.mm | 2 ++ 1 file changed, 2 insertions(+) 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); -- 2.47.2