Fix crash when single-selecting large media.

This commit is contained in:
Greyson Parrelli 2019-03-20 23:01:32 -07:00
parent 93c1277fd0
commit 148cfd1b53

View File

@ -129,11 +129,13 @@ class MediaSendViewModel extends ViewModel {
if (filteredMedia.isEmpty()) { if (filteredMedia.isEmpty()) {
error.setValue(Error.ITEM_TOO_LARGE); 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; countButtonVisibility = CountButtonState.Visibility.FORCED_OFF;
bucketId.setValue(filteredMedia.get(0).getBucketId().or(Media.ALL_MEDIA_BUCKET_ID));
selectedMedia.setValue(filteredMedia); selectedMedia.setValue(filteredMedia);
countButtonState.setValue(new CountButtonState(filteredMedia.size(), countButtonVisibility)); countButtonState.setValue(new CountButtonState(filteredMedia.size(), countButtonVisibility));
}); });