android: Fix a potential NullPointerException in the IMC state fragment
authorTobias Brunner <tobias@strongswan.org>
Mon, 22 Jun 2015 15:22:05 +0000 (17:22 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 28 Jul 2015 11:27:31 +0000 (13:27 +0200)
src/frontends/android/src/org/strongswan/android/ui/ImcStateFragment.java

index 39f86b4..7680ee6 100644 (file)
@@ -24,6 +24,7 @@ import org.strongswan.android.logic.imc.ImcState;
 import org.strongswan.android.logic.imc.RemediationInstruction;
 
 import android.app.Fragment;
+import android.app.FragmentManager;
 import android.app.FragmentTransaction;
 import android.app.Service;
 import android.content.ComponentName;
@@ -174,7 +175,12 @@ public class ImcStateFragment extends Fragment implements VpnStateListener
 
        public void updateView()
        {
-               FragmentTransaction ft = getFragmentManager().beginTransaction();
+               FragmentManager fm = getFragmentManager();
+               if (fm == null)
+               {
+                       return;
+               }
+               FragmentTransaction ft = fm.beginTransaction();
 
                switch (mService.getImcState())
                {