crashfix: thread.uniqueId is sometimes nil in production
fail early and print diagnostics // FREEBIE
This commit is contained in:
parent
bb8f6c1b73
commit
2cd2596ddc
|
@ -487,8 +487,17 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
|
|||
_callOnOpen = callOnViewAppearing;
|
||||
|
||||
[self.uiDatabaseConnection beginLongLivedReadTransaction];
|
||||
self.messageMappings =
|
||||
[[YapDatabaseViewMappings alloc] initWithGroups:@[ thread.uniqueId ] view:TSMessageDatabaseViewExtensionName];
|
||||
|
||||
if (thread.uniqueId.length > 0) {
|
||||
self.messageMappings = [[YapDatabaseViewMappings alloc] initWithGroups:@[ thread.uniqueId ]
|
||||
view:TSMessageDatabaseViewExtensionName];
|
||||
} else {
|
||||
OWSFail(@"uniqueId unexpectedly empty for thread: %@", thread);
|
||||
self.messageMappings =
|
||||
[[YapDatabaseViewMappings alloc] initWithGroups:@[] view:TSMessageDatabaseViewExtensionName];
|
||||
return;
|
||||
}
|
||||
|
||||
// We need to impose the range restrictions on the mappings immediately to avoid
|
||||
// doing a great deal of unnecessary work and causing a perf hotspot.
|
||||
[self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
||||
|
|
|
@ -726,6 +726,11 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
|
|||
keyboardOnViewAppearing:(BOOL)keyboardOnViewAppearing
|
||||
callOnViewAppearing:(BOOL)callOnViewAppearing
|
||||
{
|
||||
if (thread == nil) {
|
||||
OWSFail(@"Thread unexpectedly nil");
|
||||
return;
|
||||
}
|
||||
|
||||
// We do this synchronously if we're already on the main thread.
|
||||
DispatchMainThreadSafe(^{
|
||||
MessagesViewController *mvc = [[MessagesViewController alloc] initWithNibName:@"MessagesViewController"
|
||||
|
|
Loading…
Reference in New Issue