From c1b4efb4bea2a0364822a8160f74e4557b18e913 Mon Sep 17 00:00:00 2001 From: Adam Newman Date: Tue, 27 Mar 2018 10:10:43 -0700 Subject: [PATCH] Fix CaptivePortalLoginActivity null String crash In getHeaderTitle if NetworkInfo.getExtraInfo() returns null the call to replaceAll will result in an NPE and if the string weren't null an empty string would set the title to "Sign in to ". Add a TextUtils.isEmpty check before displaying the formatted title to temporarily fix the NPE until an alternative method to obtain SSID is implemented. Bug: 77114259 Test: Manually launching with a captive portal network. Change-Id: I3ce9a6dc65cceb9344700803966d4f0aa12d894c --- .../android/captiveportallogin/CaptivePortalLoginActivity.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java b/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java index 7828c4caa7abd..dbdf5e16803b8 100644 --- a/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java +++ b/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java @@ -35,6 +35,7 @@ import android.os.Build; import android.os.Bundle; import android.provider.Settings; import android.support.v4.widget.SwipeRefreshLayout; +import android.text.TextUtils; import android.util.ArrayMap; import android.util.Log; import android.util.TypedValue; @@ -531,7 +532,7 @@ public class CaptivePortalLoginActivity extends Activity { private String getHeaderTitle() { NetworkInfo info = mCm.getNetworkInfo(mNetwork); - if (info == null) { + if (info == null || TextUtils.isEmpty(info.getExtraInfo())) { return getString(R.string.action_bar_label); } NetworkCapabilities nc = mCm.getNetworkCapabilities(mNetwork);