From d9f0c86c2e5ec4f3f84cd4d01a4b9aef22404f71 Mon Sep 17 00:00:00 2001 From: Peter Serwylo Date: Fri, 5 Feb 2016 22:27:11 +1100 Subject: [PATCH] Put null check around access of `R.id.header` fragment. Please note I haven't reproduced the specific problem. Also, the stack traces being reported are only marginally informative, because they are in response to a content providers firing events, and thus don't have any context about when or where the event was fired from. However, my looking at the code seems to indicate that this will prevent NPE when the Activity is no longer visible but an app is finished installing. Also, the view should still update correctly on resuming the Activity because the `onResumeFragments()` methods will be invoked which invokes the `refreshHeaders()` method. Fixes #286. --- F-Droid/src/org/fdroid/fdroid/AppDetails.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/F-Droid/src/org/fdroid/fdroid/AppDetails.java b/F-Droid/src/org/fdroid/fdroid/AppDetails.java index 63002cf66..561645b84 100644 --- a/F-Droid/src/org/fdroid/fdroid/AppDetails.java +++ b/F-Droid/src/org/fdroid/fdroid/AppDetails.java @@ -609,7 +609,9 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A private void refreshHeader() { mHeaderFragment = (AppDetailsHeaderFragment) getSupportFragmentManager().findFragmentById(R.id.header); - mHeaderFragment.updateViews(); + if (mHeaderFragment != null) { + mHeaderFragment.updateViews(); + } } @Override