From d0a0019668cc7eef8f5cbc5d2c6e7dbbc1522da6 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sun, 18 Oct 2009 06:16:30 +0000 Subject: [PATCH] CYJSObject objectForKey: should be returning nil for undefined keys. --- Library.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Library.mm b/Library.mm index 8116d53..92e43ed 100644 --- a/Library.mm +++ b/Library.mm @@ -1434,7 +1434,10 @@ bool CYIsCallable(JSContextRef context, JSValueRef value) { } - (id) objectForKey:(id)key { - return CYCastNSObject(NULL, context_, CYGetProperty(context_, object_, CYJSString(key))) ?: [NSNull null]; + JSValueRef value(CYGetProperty(context_, object_, CYJSString(key))); + if (JSValueIsUndefined(context_, value)) + return nil; + return CYCastNSObject(NULL, context_, value) ?: [NSNull null]; } - (NSEnumerator *) keyEnumerator { -- 2.49.0