Update notification fragment logging to simplify null checks

This commit is contained in:
HellPie 2018-09-04 08:51:17 +02:00 committed by HellPie
parent 40ae45e126
commit c62b523152
1 changed files with 6 additions and 15 deletions

View File

@ -506,21 +506,12 @@ public class NotificationsFragment extends SFragment implements
NotificationViewData notification = notifications.getPairedItem(position);
if(!(notification instanceof NotificationViewData.Concrete)) {
if(notification == null) {
Log.e(TAG, String.format(
"Tried to access notification but got null at position: %d of %d",
position,
notifications.size() - 1)
);
} else {
Log.e(TAG, String.format(
"Expected NotificationViewData.Concrete, got %s instead at position: %d of %d",
notification.getClass().getSimpleName(),
position,
notifications.size() - 1
));
}
Log.e(TAG, String.format(
"Expected NotificationViewData.Concrete, got %s instead at position: %d of %d",
notification == null ? "null" : notification.getClass().getSimpleName(),
position,
notifications.size() - 1
));
return;
}