From: Jay Freeman (saurik) Date: Sun, 18 Oct 2009 06:16:30 +0000 (+0000) Subject: CYJSObject objectForKey: should be returning nil for undefined keys. X-Git-Tag: v0.9.432~326 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/d0a0019668cc7eef8f5cbc5d2c6e7dbbc1522da6?ds=inline CYJSObject objectForKey: should be returning nil for undefined keys. --- 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 {