OSDN Git Service

Add null check before finish SystemUI Tuner's activity
authorAkira Oshimi <akira.x.oshimi@sonymobile.com>
Thu, 29 Sep 2016 03:17:24 +0000 (12:17 +0900)
committerYoshinori Hirano <Yoshinori.Hirano@sonymobile.com>
Thu, 10 Nov 2016 09:09:25 +0000 (09:09 +0000)
SystemUI Tuner's activity changes to null when Multi-window's state is
changed after confirmation dialog about removing SystemUI Tuner is
shown. Then NullPointerException occurs by trying to finish the
activity to tap "REMOVE" button on the confirmation dialog.
So add null check before finish the activity.

Bug: 32786029
Test: manual - remove System UI Tuner on Multi-Window mode

Change-Id: I455d17c0c600eeb05c9dfb7d609d40307de2f855

packages/SystemUI/src/com/android/systemui/tuner/TunerFragment.java

index 70f2fdc..7afdbcb 100644 (file)
@@ -104,7 +104,9 @@ public class TunerFragment extends PreferenceFragment {
                 TunerService.showResetRequest(getContext(), new Runnable() {
                     @Override
                     public void run() {
-                        getActivity().finish();
+                        if (getActivity() != null) {
+                            getActivity().finish();
+                        }
                     }
                 });
                 return true;