Skip to content

Commit

Permalink
fixed: exception was being thrown when no no location has been retrie…
Browse files Browse the repository at this point in the history
…ved yet, now handled gracefully
  • Loading branch information
Ryan Willoughby committed May 27, 2010
1 parent a1fe399 commit 802a83e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion js/geolocation.js
Expand Up @@ -47,7 +47,7 @@ Geolocation.prototype.getCurrentPosition = function(successCallback, errorCallba
delay += interval;

//if we have a new position, call success and cancel the timer
if (typeof(dis.lastPosition) == 'object' && dis.lastPosition.timestamp > referenceTime) {
if (dis.lastPosition && typeof(dis.lastPosition) == 'object' && dis.lastPosition.timestamp > referenceTime) {
successCallback(dis.lastPosition);
clearInterval(timer);
} else if (delay >= timeout) { //else if timeout has occured then call error and cancel the timer
Expand Down

0 comments on commit 802a83e

Please sign in to comment.