am bc20d67f: Merge "Avoid crash when switching to 2G/3G network."
* commit 'bc20d67fedd453eec9dcb127cf9df909a192baf5':
Avoid crash when switching to 2G/3G network.
diff --git a/src/com/android/settings/RadioInfo.java b/src/com/android/settings/RadioInfo.java
index f0fcdd7..f1c30d0 100644
--- a/src/com/android/settings/RadioInfo.java
+++ b/src/com/android/settings/RadioInfo.java
@@ -774,15 +774,18 @@
sb.append("\n to ")
.append(pdp.getApn().toString());
}
- sb.append("\ninterface: ")
- .append(phone.getInterfaceName(phone.getActiveApnTypes()[0]))
- .append("\naddress: ")
- .append(phone.getIpAddress(phone.getActiveApnTypes()[0]))
- .append("\ngateway: ")
- .append(phone.getGateway(phone.getActiveApnTypes()[0]));
- String[] dns = phone.getDnsServers(phone.getActiveApnTypes()[0]);
- if (dns != null) {
- sb.append("\ndns: ").append(dns[0]).append(", ").append(dns[1]);
+ String[] activeApnTypes = phone.getActiveApnTypes();
+ if (activeApnTypes.length > 0) {
+ sb.append("\ninterface: ")
+ .append(phone.getInterfaceName(activeApnTypes[0]))
+ .append("\naddress: ")
+ .append(phone.getIpAddress(activeApnTypes[0]))
+ .append("\ngateway: ")
+ .append(phone.getGateway(activeApnTypes[0]));
+ String[] dns = phone.getDnsServers(activeApnTypes[0]);
+ if (dns != null) {
+ sb.append("\ndns: ").append(dns[0]).append(", ").append(dns[1]);
+ }
}
} else if (dc.isInactive()) {
sb.append(" disconnected with last try at ")