From 39a682fa1d12428e3bbe03ac444128c2e65c8bcc Mon Sep 17 00:00:00 2001 From: Chris Narkiewicz Date: Sun, 4 Jul 2021 15:17:36 +0100 Subject: [PATCH] Fix NPE when navigating out of PreviewMediaFragment during video loading Although original error has been fixed by migration to Exo player, there is still a potential NPE when fragment went through onDestroyView(). Fixes #8620 Signed-off-by: Chris Narkiewicz --- .../com/owncloud/android/ui/preview/PreviewMediaFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java b/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java index 2be4027b84..50bebb739b 100644 --- a/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java +++ b/src/main/java/com/owncloud/android/ui/preview/PreviewMediaFragment.java @@ -507,7 +507,7 @@ public class PreviewMediaFragment extends FileFragment implements OnTouchListene protected void onPostExecute(Uri uri) { final PreviewMediaFragment previewMediaFragment = previewMediaFragmentWeakReference.get(); final Context context = previewMediaFragment != null ? previewMediaFragment.getContext() : null; - if (previewMediaFragment != null && context != null) { + if (previewMediaFragment != null && previewMediaFragment.binding != null && context != null) { if (uri != null) { previewMediaFragment.videoUri = uri;