Catch NPE on network state and fall back to empty summary.

am: 6acb76621d

Change-Id: I208a614e1a29c0d0e523d712ea184ee87fc04254
This commit is contained in:
Fan Zhang
2016-10-18 21:37:30 +00:00
committed by android-build-merger

View File

@@ -356,7 +356,11 @@ public class AccessPoint implements Comparable<AccessPoint> {
}
public DetailedState getDetailedState() {
return mNetworkInfo != null ? mNetworkInfo.getDetailedState() : null;
if (mNetworkInfo != null) {
return mNetworkInfo.getDetailedState();
}
Log.w(TAG, "NetworkInfo is null, cannot return detailed state");
return null;
}
public String getSavedNetworkSummary() {
@@ -798,7 +802,10 @@ public class AccessPoint implements Comparable<AccessPoint> {
return context.getString(R.string.wifi_connected_no_internet);
}
}
if (state == null) {
Log.w(TAG, "state is null, returning empty summary");
return "";
}
String[] formats = context.getResources().getStringArray((ssid == null)
? R.array.wifi_status : R.array.wifi_status_with_ssid);
int index = state.ordinal();