Skip to content

Commit ec91cf4

Browse files
committed
fix(file-detail): show snackbar crash
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
1 parent 3475330 commit ec91cf4

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

app/src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,10 @@ private void fetchSharees() {
186186
return Unit.INSTANCE;
187187
}, () -> {
188188
showShareContainer();
189-
DisplayUtils.showSnackMessage(getView(), R.string.error_fetching_sharees);
189+
final var view = getView();
190+
if (view != null) {
191+
DisplayUtils.showSnackMessage(view, R.string.error_fetching_sharees);
192+
}
190193
return Unit.INSTANCE;
191194
});
192195
}
@@ -411,7 +414,10 @@ public void copyInternalLink() {
411414
OwnCloudAccount account = accountManager.getCurrentOwnCloudAccount();
412415

413416
if (account == null) {
414-
DisplayUtils.showSnackMessage(getView(), getString(R.string.could_not_retrieve_url));
417+
final var view = getView();
418+
if (view != null) {
419+
DisplayUtils.showSnackMessage(view, getString(R.string.could_not_retrieve_url));
420+
}
415421
return;
416422
}
417423

@@ -575,7 +581,10 @@ public void refreshSharesFromDB() {
575581
}
576582

577583
if (internalShareeListAdapter == null) {
578-
DisplayUtils.showSnackMessage(getView(), getString(R.string.could_not_retrieve_shares));
584+
final var view = getView();
585+
if (view != null) {
586+
DisplayUtils.showSnackMessage(view, getString(R.string.could_not_retrieve_shares));
587+
}
579588
return;
580589
}
581590

@@ -728,7 +737,10 @@ public void unShare(OCShare share) {
728737
fileDataStorageManager.updateFileEntity(entity);
729738
}
730739
} else {
731-
DisplayUtils.showSnackMessage(getView(), getString(R.string.failed_update_ui));
740+
final var view = getView();
741+
if (view != null) {
742+
DisplayUtils.showSnackMessage(view, getString(R.string.failed_update_ui));
743+
}
732744
}
733745
}
734746

0 commit comments

Comments
 (0)