incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [1/2] android commit: Fix a NPE in GeoBroker when there is no previous location.
Date Thu, 09 Aug 2012 03:39:49 GMT
Updated Branches:
  refs/heads/master c52dc10c9 -> b297fe6f5


Fix a NPE in GeoBroker when there is no previous location.


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/b297fe6f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/b297fe6f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/b297fe6f

Branch: refs/heads/master
Commit: b297fe6f597358713fb2dbf70253d54552f25283
Parents: e575212
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Wed Aug 8 23:39:02 2012 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Wed Aug 8 23:39:02 2012 -0400

----------------------------------------------------------------------
 framework/src/org/apache/cordova/GeoBroker.java |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/b297fe6f/framework/src/org/apache/cordova/GeoBroker.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/GeoBroker.java b/framework/src/org/apache/cordova/GeoBroker.java
index 05c427d..9b0838b 100755
--- a/framework/src/org/apache/cordova/GeoBroker.java
+++ b/framework/src/org/apache/cordova/GeoBroker.java
@@ -75,7 +75,7 @@ public class GeoBroker extends Plugin {
 	                int maximumAge = args.getInt(1);
 	                Location last = this.locationManager.getLastKnownLocation((enableHighAccuracy
? LocationManager.GPS_PROVIDER : LocationManager.NETWORK_PROVIDER));
 	                // Check if we can use lastKnownLocation to get a quick reading and use
less battery
-	                if ((System.currentTimeMillis() - last.getTime()) <= maximumAge) {
+	                if (last != null && (System.currentTimeMillis() - last.getTime())
<= maximumAge) {
 	                    result = new PluginResult(PluginResult.Status.OK, this.returnLocationJSON(last));
 	                } else {
 	                    this.getCurrentLocation(callbackId, enableHighAccuracy);


Mime
View raw message