From ec8feb9f9146e278c5e920eae0bbbe6490a383e4 Mon Sep 17 00:00:00 2001 From: Tobi Date: Wed, 24 Mar 2021 11:32:07 +0100 Subject: [PATCH] Merge pull request TeamNewPipe/NewPipe#5896 from Stypox/fix-error-panel Fix error panel created in onViewCreated() but disposed in onDestroy() --- .../newpipelegacy/fragments/BaseStateFragment.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipelegacy/fragments/BaseStateFragment.java b/app/src/main/java/org/schabi/newpipelegacy/fragments/BaseStateFragment.java index b60d3f7b9..2dff23c86 100644 --- a/app/src/main/java/org/schabi/newpipelegacy/fragments/BaseStateFragment.java +++ b/app/src/main/java/org/schabi/newpipelegacy/fragments/BaseStateFragment.java @@ -56,12 +56,6 @@ public void onResume() { } } - @Override - public void onDestroy() { - super.onDestroy(); - errorPanelHelper.dispose(); - } - /*////////////////////////////////////////////////////////////////////////// // Init //////////////////////////////////////////////////////////////////////////*/ @@ -74,6 +68,14 @@ protected void initViews(final View rootView, final Bundle savedInstanceState) { errorPanelHelper = new ErrorPanelHelper(this, rootView, this::onRetryButtonClicked); } + @Override + public void onDestroyView() { + super.onDestroyView(); + if (errorPanelHelper != null) { + errorPanelHelper.dispose(); + } + } + protected void onRetryButtonClicked() { reloadContent(); }