From 0cf4732d8a8b99d81cd6c9d29303cd731c7393a5 Mon Sep 17 00:00:00 2001 From: Elva Kang Date: Sat, 19 Oct 2024 19:43:34 +1100 Subject: [PATCH] Fix UI crash when user navigates away before the download dialog appears --- .../newpipe/info_list/dialog/StreamDialogDefaultEntry.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/info_list/dialog/StreamDialogDefaultEntry.java b/app/src/main/java/org/schabi/newpipe/info_list/dialog/StreamDialogDefaultEntry.java index 948a8274c..6b9e38b98 100644 --- a/app/src/main/java/org/schabi/newpipe/info_list/dialog/StreamDialogDefaultEntry.java +++ b/app/src/main/java/org/schabi/newpipe/info_list/dialog/StreamDialogDefaultEntry.java @@ -113,7 +113,7 @@ public enum StreamDialogDefaultEntry { DOWNLOAD(R.string.download, (fragment, item) -> fetchStreamInfoAndSaveToDatabase(fragment.requireContext(), item.getServiceId(), item.getUrl(), info -> { - if (fragment.getContext() != null) { + if (fragment.isAdded() && !fragment.isStateSaved()) { final DownloadDialog downloadDialog = new DownloadDialog(fragment.requireContext(), info); downloadDialog.show(fragment.getChildFragmentManager(),