Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Realm/RLMError.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ typedef RLM_ERROR_ENUM(NSInteger, RLMError, RLMErrorDomain) {
subscription or the server will reject the write.
*/
RLMErrorNoSubscriptionForWrite = 22,
/ **
Denotes an error that occurs when resolving thread safe reference returns a nil object.
*/
RLMErrorObjectNotFound = 23
};

#pragma mark - RLMSyncError
Expand Down
7 changes: 7 additions & 0 deletions Realm/RLMObjectBase.mm
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,13 @@ - (void)addNotificationBlock:(RLMObjectNotificationCallback)block
return;
}
RLMObjectBase *obj = [_realm resolveThreadSafeReference:tsr];
if (!obj) {
error = [NSError errorWithDomain:RLMAppErrorDomain
code:RLMErrorObjectNotFound
userInfo:nil];
block(nil, nil, nil, nil, error);
return;
}

_object = realm::Object(_realm->_realm, *obj->_info->objectSchema, obj->_row);
_token = _object.add_notification_callback(ObjectChangeCallbackWrapper{block, obj},
Expand Down