Merge "Catch NPE on network state and fall back to empty summary." into nyc-mr1-dev

This commit is contained in:
TreeHugger Robot
2016-10-18 21:27:44 +00:00
committed by Android (Google) Code Review

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();