4.0 crash with nil


I updated my Swift iOS app to Realm 4.0. It is now crashing in RLMObjectBase.mm valueForUndefinedKey (called from valueForKey) when the key is nil. This is happening in a NSPredicate evaluate call when the expression would evaluate to false.

The stack looks like:

Thread 2 Queue : com.apple.cloudkit.operation-A3D6124DD7069BF8.callback (serial)
#0 0x00000001991f1028 in objc_retain ()
#1 0x000000010690b294 in ::-[RLMObjectBase valueForUndefinedKey:](NSString *) at //Carthage/Checkouts/realm-cocoa/Realm/RLMObjectBase.mm:184
#2 0x0000000199769908 in -[NSObject(NSKeyValueCoding) valueForKey:] ()
#3 0x000000010690b1d8 in ::-[RLMObjectBase valueForKey:](NSString *) at //Carthage/Checkouts/realm-cocoa/Realm/RLMObjectBase.mm:178
#4 0x0000000199769778 in -[NSObject(NSKeyValueCoding) valueForKeyPath:] ()
#5 0x0000000199792660 in -[NSFunctionExpression expressionValueWithObject:context:] ()
#6 0x00000001997922e8 in -[NSComparisonPredicate evaluateWithObject:substitutionVariables:] ()
#7 0x00000001997945a8 in -[NSCompoundPredicateOperator evaluatePredicates:withObject:substitutionVariables:] ()
#8 0x0000000199794418 in -[NSCompoundPredicate evaluateWithObject:substitutionVariables:] ()


This is still happening in 4.1.1. I cannot use any 4.x version until this is fixed. Thanks.

Edit: This nil may be a red herring and just an artifact of debugging release code. The code in 3.21.0 for valueForUndefinedKey and valueForKey is more or less the same as 4.x. Going to look into it more.

(Brian Munkholm) #3

Hi @gilroykilroy,
Sorry to hear this. This is a community forum, so if you are experiencing bugs, could you please report them in Github instead?
Please fill out the entire issue template and give any possible hints as to how this can be reproduced.