incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bows...@apache.org
Subject [2/2] android commit: Fixing CB-1521 - NullPointerException on Default Jellybean Emulator
Date Fri, 21 Sep 2012 18:51:54 GMT
Fixing CB-1521 - NullPointerException on Default Jellybean Emulator


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/commit/2a9582eb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/2a9582eb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/2a9582eb

Branch: refs/heads/master
Commit: 2a9582ebb11d50dfc9413170a0fab69cd5d2fce1
Parents: 7eb1211
Author: Joe Bowser <bowserj@apache.org>
Authored: Fri Sep 21 11:48:33 2012 -0700
Committer: Joe Bowser <bowserj@apache.org>
Committed: Fri Sep 21 11:48:33 2012 -0700

----------------------------------------------------------------------
 .../src/org/apache/cordova/NetworkManager.java     |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/2a9582eb/framework/src/org/apache/cordova/NetworkManager.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/NetworkManager.java b/framework/src/org/apache/cordova/NetworkManager.java
index 37f0933..bf4102b 100755
--- a/framework/src/org/apache/cordova/NetworkManager.java
+++ b/framework/src/org/apache/cordova/NetworkManager.java
@@ -99,7 +99,9 @@ public class NetworkManager extends Plugin {
                 @SuppressWarnings("deprecation")
                 @Override
                 public void onReceive(Context context, Intent intent) {
-                    updateConnectionInfo((NetworkInfo) intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO));
+                    // (The null check is for the ARM Emulator, please use Intel Emulator
for better results)
+                    if(webView != null)
+                        updateConnectionInfo((NetworkInfo) intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO));
                 }
             };
             cordova.getActivity().registerReceiver(this.receiver, intentFilter);
@@ -198,10 +200,9 @@ public class NetworkManager extends Plugin {
         result.setKeepCallback(true);
         this.success(result, this.connectionCallbackId);
 
-        // Send to all plugins
         webView.postMessage("networkconnection", type);
     }
-
+    
     /**
      * Determine the type of connection
      *


Mime
View raw message