CB-6907: android: Don't crash on startup if no networks available

This commit is contained in:
Ian Clelland 2014-06-10 09:50:56 -04:00
parent f4ffab9c71
commit a5e9631258

View File

@ -189,6 +189,7 @@ public class NetworkManager extends CordovaPlugin {
*/ */
private JSONObject getConnectionInfo(NetworkInfo info) { private JSONObject getConnectionInfo(NetworkInfo info) {
String type = TYPE_NONE; String type = TYPE_NONE;
String extraInfo = "";
if (info != null) { if (info != null) {
// If we are not connected to any network set type to none // If we are not connected to any network set type to none
if (!info.isConnected()) { if (!info.isConnected()) {
@ -197,8 +198,8 @@ public class NetworkManager extends CordovaPlugin {
else { else {
type = getType(info); type = getType(info);
} }
extraInfo = info.getExtraInfo();
} }
String extraInfo = info.getExtraInfo();
Log.d("CordovaNetworkManager", "Connection Type: " + type); Log.d("CordovaNetworkManager", "Connection Type: " + type);
Log.d("CordovaNetworkManager", "Connection Extra Info: " + extraInfo); Log.d("CordovaNetworkManager", "Connection Extra Info: " + extraInfo);