mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 15:23:00 +00:00 
			
		
		
		
	Merge pull request #11621 from u7656655/fixing-ui-crash-11468
Fix UI crash when user navigates away before the download dialog appears
This commit is contained in:
		| @@ -113,7 +113,10 @@ public enum StreamDialogDefaultEntry { | |||||||
|     DOWNLOAD(R.string.download, (fragment, item) -> |     DOWNLOAD(R.string.download, (fragment, item) -> | ||||||
|             fetchStreamInfoAndSaveToDatabase(fragment.requireContext(), item.getServiceId(), |             fetchStreamInfoAndSaveToDatabase(fragment.requireContext(), item.getServiceId(), | ||||||
|                     item.getUrl(), info -> { |                     item.getUrl(), info -> { | ||||||
|                         if (fragment.getContext() != null) { |                         // Ensure the fragment is attached and its state hasn't been saved to avoid | ||||||
|  |                         // showing dialog during lifecycle changes or when the activity is paused, | ||||||
|  |                         // e.g. by selecting the download option and opening a different fragment. | ||||||
|  |                         if (fragment.isAdded() && !fragment.isStateSaved()) { | ||||||
|                             final DownloadDialog downloadDialog = |                             final DownloadDialog downloadDialog = | ||||||
|                                     new DownloadDialog(fragment.requireContext(), info); |                                     new DownloadDialog(fragment.requireContext(), info); | ||||||
|                             downloadDialog.show(fragment.getChildFragmentManager(), |                             downloadDialog.show(fragment.getChildFragmentManager(), | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Tobi
					Tobi