Avoid crash when switching to 2G/3G network.

Adding test that active APN array is not empty.

Change-Id: I16246aa45c991a9396ef03d9bb083d97c3ca2e1a
This commit is contained in:
Kenneth Westin
2011-04-26 14:08:45 +02:00
committed by Johan Redestig
parent 7fceefa792
commit dd9131dcdf

View File

@@ -774,15 +774,18 @@ public class RadioInfo extends Activity {
sb.append("\n to ") sb.append("\n to ")
.append(pdp.getApn().toString()); .append(pdp.getApn().toString());
} }
sb.append("\ninterface: ") String[] activeApnTypes = phone.getActiveApnTypes();
.append(phone.getInterfaceName(phone.getActiveApnTypes()[0])) if (activeApnTypes.length > 0) {
.append("\naddress: ") sb.append("\ninterface: ")
.append(phone.getIpAddress(phone.getActiveApnTypes()[0])) .append(phone.getInterfaceName(activeApnTypes[0]))
.append("\ngateway: ") .append("\naddress: ")
.append(phone.getGateway(phone.getActiveApnTypes()[0])); .append(phone.getIpAddress(activeApnTypes[0]))
String[] dns = phone.getDnsServers(phone.getActiveApnTypes()[0]); .append("\ngateway: ")
if (dns != null) { .append(phone.getGateway(activeApnTypes[0]));
sb.append("\ndns: ").append(dns[0]).append(", ").append(dns[1]); String[] dns = phone.getDnsServers(activeApnTypes[0]);
if (dns != null) {
sb.append("\ndns: ").append(dns[0]).append(", ").append(dns[1]);
}
} }
} else if (dc.isInactive()) { } else if (dc.isInactive()) {
sb.append(" disconnected with last try at ") sb.append(" disconnected with last try at ")