From 8df935f5fe6e464852a15ea965c5323d249fa661 Mon Sep 17 00:00:00 2001 From: Saurav Rao <56369484+sauravrao637@users.noreply.github.com> Date: Thu, 1 Apr 2021 18:37:21 +0530 Subject: [PATCH] NullPointerException on screen rotation during exit fix (#5976) --- .../newpipe/fragments/detail/VideoDetailFragment.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index a5dfe2057..72e3300ed 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -1009,6 +1009,12 @@ public final class VideoDetailFragment } public void updateTabLayoutVisibility() { + + if (binding == null) { + //If binding is null we do not need to and should not do anything with its object(s) + return; + } + if (pageAdapter.getCount() < 2 || binding.viewPager.getVisibility() != View.VISIBLE) { // hide tab layout if there is only one tab or if the view pager is also hidden binding.tabLayout.setVisibility(View.GONE);