Skip to content

Commit

Permalink
Merge pull request #3554 from deltachat/adb/issue-3542
Browse files Browse the repository at this point in the history
avoid crash in MediaPreviewActivity.onPageUnselected
  • Loading branch information
adbenitez authored Jan 21, 2025
2 parents a9c488f + 3059403 commit d30e141
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,12 @@ public void onPageUnselected(int position) {
MediaItemAdapter adapter = (MediaItemAdapter)mediaPager.getAdapter();

if (adapter != null) {
MediaItem item = adapter.getMediaItemFor(position);
if (item.recipient != null) item.recipient.removeListener(MediaPreviewActivity.this);

try {
MediaItem item = adapter.getMediaItemFor(position);
if (item.recipient != null) item.recipient.removeListener(MediaPreviewActivity.this);
} catch (IllegalArgumentException e) {
Log.w(TAG, "Ignoring invalid position index");
}
adapter.pause(position);
}
}
Expand Down

0 comments on commit d30e141

Please sign in to comment.