Fixes crash (since ee07490) on loading empty MessagesVC

//FREEBIE
pull/1/head
Frederic Jacobs 10 years ago
parent 1784fcf900
commit f3f3eb55cc

@ -155,9 +155,12 @@ typedef enum : NSUInteger {
{
[super viewWillAppear:animated];
NSIndexPath * lastCellIndexPath = [NSIndexPath indexPathForRow:(NSInteger)[self.messageMappings numberOfItemsInGroup:self.thread.uniqueId]-1 inSection:0];
[self.collectionView scrollToItemAtIndexPath:lastCellIndexPath atScrollPosition:UICollectionViewScrollPositionBottom animated:NO];
NSInteger numberOfMessages = (NSInteger)[self.messageMappings numberOfItemsInGroup:self.thread.uniqueId];
if (numberOfMessages > 0) {
NSIndexPath * lastCellIndexPath = [NSIndexPath indexPathForRow:numberOfMessages-1 inSection:0];
[self.collectionView scrollToItemAtIndexPath:lastCellIndexPath atScrollPosition:UICollectionViewScrollPositionBottom animated:NO];
}
}
- (void)startReadTimer{
@ -1143,7 +1146,6 @@ typedef enum : NSUInteger {
self.thread = gThread;
}];
}
- (IBAction)unwindGroupUpdated:(UIStoryboardSegue *)segue{

Loading…
Cancel
Save