From 148cfd1b53894c7a1c64552736cbcf81eb008e9d Mon Sep 17 00:00:00 2001 From: Greyson Parrelli Date: Wed, 20 Mar 2019 23:01:32 -0700 Subject: [PATCH] Fix crash when single-selecting large media. --- .../thoughtcrime/securesms/mediasend/MediaSendViewModel.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/org/thoughtcrime/securesms/mediasend/MediaSendViewModel.java b/src/org/thoughtcrime/securesms/mediasend/MediaSendViewModel.java index f5fc91ff59..6dac4c66df 100644 --- a/src/org/thoughtcrime/securesms/mediasend/MediaSendViewModel.java +++ b/src/org/thoughtcrime/securesms/mediasend/MediaSendViewModel.java @@ -129,11 +129,13 @@ class MediaSendViewModel extends ViewModel { if (filteredMedia.isEmpty()) { error.setValue(Error.ITEM_TOO_LARGE); + bucketId.setValue(Media.ALL_MEDIA_BUCKET_ID); + } else { + bucketId.setValue(filteredMedia.get(0).getBucketId().or(Media.ALL_MEDIA_BUCKET_ID)); } countButtonVisibility = CountButtonState.Visibility.FORCED_OFF; - bucketId.setValue(filteredMedia.get(0).getBucketId().or(Media.ALL_MEDIA_BUCKET_ID)); selectedMedia.setValue(filteredMedia); countButtonState.setValue(new CountButtonState(filteredMedia.size(), countButtonVisibility)); });