From dba47b578e134aae5e0a4089bf3d5ec0701b609a Mon Sep 17 00:00:00 2001 From: Dennis Reimann Date: Fri, 26 Apr 2013 15:07:15 +0200 Subject: [PATCH] Fixes #388 --- Classes/IOCNotificationsController.m | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Classes/IOCNotificationsController.m b/Classes/IOCNotificationsController.m index 0cd6b5f1..b6bfd47d 100644 --- a/Classes/IOCNotificationsController.m +++ b/Classes/IOCNotificationsController.m @@ -77,9 +77,10 @@ - (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSIn // marks the notification as read, but keeps the cell - (void)markAsRead:(NSIndexPath *)indexPath { - NSInteger section = indexPath.section; - GHNotification *notification = [self notificationsInSection:section][indexPath.row]; - [self.notifications markAsRead:notification start:nil success:nil failure:nil]; + NSArray *notifications = [self notificationsInSection:indexPath.section]; + if (indexPath.row >= notifications.count) return; + GHNotification *notification = notifications[indexPath.row]; + [self.notifications markAsRead:notification start:nil success:nil failure:nil]; } // marks the notification as read and removes the cell