Correctly handle invalid conversation ID
This commit is contained in:
parent
07513480ef
commit
e8f945fbcb
|
@ -327,16 +327,25 @@ public class NotificationsFragment extends SFragment implements
|
|||
|
||||
private void handleMuteStatusEvent(MuteStatusEvent event) {
|
||||
Pair<Integer, Notification> posAndNotification = findReplyPosition(event.getStatusId());
|
||||
if (posAndNotification == null) return;
|
||||
if (posAndNotification == null)
|
||||
return;
|
||||
|
||||
int conversaionId = posAndNotification.second.getStatus().getConversationId();
|
||||
|
||||
if(conversationId == -1) { // invalid conversation ID
|
||||
setMutedStatusForStatus(posAndNotification.first, posAndNotification.second.getStatus(), event.getMute());
|
||||
} else {
|
||||
//noinspection ConstantConditions
|
||||
// using iterator to safely remove items while iterating
|
||||
for (int i = 0; i < notifications.size(); i++) {
|
||||
Notification notification = notifications.get(i).asRightOrNull();
|
||||
if (notification != null && notification.getStatus() != null
|
||||
&& notification.getType() == Notification.Type.MENTION) {
|
||||
&& notification.getType() == Notification.Type.MENTION &&
|
||||
notification.getStatus().getConversationId() == conversaionId) {
|
||||
setMutedStatusForStatus(i, notification.getStatus(), event.getMute());
|
||||
}
|
||||
}
|
||||
}
|
||||
updateAdapter();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue