{"action":"closed","issue":{"url":"https://api.github.com/repos/realm/realm-cocoa/issues/4933","repository_url":"https://api.github.com/repos/realm/realm-cocoa","labels_url":"https://api.github.com/repos/realm/realm-cocoa/issues/4933/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-cocoa/issues/4933/comments","events_url":"https://api.github.com/repos/realm/realm-cocoa/issues/4933/events","html_url":"https://github.com/realm/realm-cocoa/issues/4933","id":227032380,"number":4933,"title":"Crash on addOrUpdateObject with a nil value on iOS 9.3.5","user":{"login":"dsanghan","id":6698354,"avatar_url":"https://avatars0.githubusercontent.com/u/6698354?v=3","gravatar_id":"","url":"https://api.github.com/users/dsanghan","html_url":"https://github.com/dsanghan","followers_url":"https://api.github.com/users/dsanghan/followers","following_url":"https://api.github.com/users/dsanghan/following{/other_user}","gists_url":"https://api.github.com/users/dsanghan/gists{/gist_id}","starred_url":"https://api.github.com/users/dsanghan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsanghan/subscriptions","organizations_url":"https://api.github.com/users/dsanghan/orgs","repos_url":"https://api.github.com/users/dsanghan/repos","events_url":"https://api.github.com/users/dsanghan/events{/privacy}","received_events_url":"https://api.github.com/users/dsanghan/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-05-08T12:37:33Z","updated_at":"2017-05-08T12:45:32Z","closed_at":"2017-05-08T12:45:32Z","body":"<!---\r\n\r\nWe LOVE to help with any issues or bugs you have!\r\n**Questions**: If you have questions about how to use Realm, ask on\r\n[StackOverflow](http://stackoverflow.com/questions/ask?tags=realm).\r\nWe monitor the `realm` tag.\r\n\r\n**Feature Request**: Just fill in the first two sections below.\r\n\r\n**Bugs**: To help you as fast as possible with an issue please describe your issue\r\nand the steps you have taken to reproduce it in as many details as possible.\r\n\r\nThanks for helping us help you! :-)\r\n-->\r\n\r\n## Goals\r\nRealm works without issue.\r\n\r\n## Expected Results\r\nRealm works without issue.\r\n\r\n## Actual Results\r\nRealm crashes on using optional properties with nil values\r\n\r\n## Steps to Reproduce\r\nFound on iPhone 4S running 9.3.5\r\n\r\n1. Create an instance of a realm\r\n2. Create an RLMObject subclass and add some optional properties to it (for eg):\r\n```\r\n@interface CCRealmAttachment : RLMObject\r\n\r\n@property (nonatomic, readwrite, strong) NSString *filename;\r\n@property (nonatomic, readwrite, strong) NSString *mid;\r\n@property (nonatomic, readwrite, strong) NSString *mimeType;\r\n\r\n@property (nonatomic, readwrite, strong) NSNumber<RLMBool> *isInline;\r\n\r\n@property (nonatomic, readwrite, strong) NSString *uniqueID;\r\n@property (nonatomic, readwrite, strong) NSString *contentId;\r\n@property (nonatomic, readwrite, strong) NSString *partId;\r\n@property (nonatomic, readwrite, strong) NSNumber<RLMInt> *encoding;\r\n\r\n@property (nonatomic, readwrite, strong) NSNumber<RLMInt> *size;\r\n@property (nonatomic, readwrite, strong) NSString *savedName;\r\n@property (nonatomic, readwrite, strong) NSString *key;\r\n\r\n@end\r\n```\r\n3. Set size/savedName to nil\r\n```\r\nCCRealmAttachment {\r\n\tfilename = IMG_5628.jpg;\r\n\tmid = 172;\r\n\tmimeType = image/JPEG;\r\n\tisInline = 1;\r\n\tuniqueID = 0;\r\n\tcontentId = ii_15b2da2afe5f083c;\r\n\tpartId = 2;\r\n\tencoding = 3;\r\n\tsize = (null);\r\n\tsavedName = (null);\r\n\tkey = IMG_5628.jpg_0_172;\r\n}\r\n```\r\n4. Call addOrUpdateObject: on the realm created above\r\n5. Realm crashes:\r\n```\r\n0  libobjc.A.dylib                0x22ce7a76 objc_msgSend + 21\r\n1  Canary-iOS                     0x423287 -[RLMObjectBase valueForKey:] (RLMObjectBase.mm:177)\r\n2  Canary-iOS                     0x42a90d RLMAddObjectToRealm (RLMObjectStore.mm:296)\r\n3  Canary-iOS                     0x493f91 -[RLMRealm addOrUpdateObject:] (RLMRealm.mm:695)\r\n```\r\n\r\nSorry can't share the project, but the crash occurs on our own devices and is 100% reproducible so I can help debug it.\r\n\r\n## Version of Realm and Tooling\r\n```\r\nProductName:\tiOS\r\nProductVersion:\t9.3.5\r\n\r\n/Applications/Xcode.app/Contents/Developer\r\nXcode 8.2.1\r\nBuild version 8C1002\r\n\r\n/usr/local/bin/pod\r\n1.2.0\r\nRealm (2.6.2)\r\n\r\n/bin/bash\r\nGNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15)\r\n\r\n\r\n(not in use here)\r\n\r\n/usr/bin/git\r\ngit version 2.10.1 (Apple Git-78)\r\n```\r\n"}}
{"actor":{"display_login":"dsanghan"}}