Skip to content

Commit

Permalink
Handle nullability of snackbarAttachView in MediaBrowserActivity
Browse files Browse the repository at this point in the history
  • Loading branch information
irfano committed Jun 21, 2024
1 parent 220b498 commit dc1e024
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1203,10 +1203,11 @@ public void onSiteChanged(OnSiteChanged event) {
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEventMainThread(UploadService.UploadErrorEvent event) {
EventBus.getDefault().removeStickyEvent(event);
if (event.mediaModelList != null && !event.mediaModelList.isEmpty()) {
View snackbarAttachView = findViewById(R.id.tab_layout);
if (event.mediaModelList != null && !event.mediaModelList.isEmpty() && snackbarAttachView != null) {
mUploadUtilsWrapper.onMediaUploadedSnackbarHandler(
this,
findViewById(R.id.tab_layout),
snackbarAttachView,
true,
!TextUtils.isEmpty(event.errorMessage)
&& event.errorMessage.contains(getString(R.string.error_media_quota_exceeded))
Expand All @@ -1223,10 +1224,10 @@ public void onEventMainThread(UploadService.UploadErrorEvent event) {
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEventMainThread(UploadService.UploadMediaSuccessEvent event) {
EventBus.getDefault().removeStickyEvent(event);
if (event.mediaModelList != null && !event.mediaModelList.isEmpty()) {
mUploadUtilsWrapper.onMediaUploadedSnackbarHandler(this,
findViewById(R.id.tab_layout), false,
event.mediaModelList, mSite, event.successMessage);
View snackbarAttachView = findViewById(R.id.tab_layout);
if (event.mediaModelList != null && !event.mediaModelList.isEmpty() && snackbarAttachView != null) {
mUploadUtilsWrapper.onMediaUploadedSnackbarHandler(this, snackbarAttachView, false, event.mediaModelList,
mSite, event.successMessage);
updateMediaGridForTheseMedia(event.mediaModelList);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class UploadUtilsWrapper @Inject constructor(
@Suppress("LongParameterList")
fun onMediaUploadedSnackbarHandler(
activity: Activity?,
snackbarAttachView: View?,
snackbarAttachView: View,
isError: Boolean,
mediaList: List<MediaModel?>?,
site: SiteModel?,
Expand Down

0 comments on commit dc1e024

Please sign in to comment.