Skip to content

Commit

Permalink
skip null locations
Browse files Browse the repository at this point in the history
  • Loading branch information
githengi authored and ekigamba committed Jan 29, 2020
1 parent c1a26ab commit d1fd374
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public void requestLocationUpdates(@NonNull LocationListener locationListener) {
if (isProviderEnabled()) {
try {
Location location = locationManager.getLastKnownLocation(getProvider());
if (lastLocation == null || (location != null && isBetterLocation(location, lastLocation))) {
if (location != null && (lastLocation == null || (location != null && isBetterLocation(location, lastLocation)))) {
lastLocation = location;
KujakuLibrary.getInstance()
.showToast(String.format(Locale.ENGLISH, "A new location received : \nProvider: %s\nAccuracy: %f\nPoint (%f, %f)", location.getProvider(), location.getAccuracy(), location.getLatitude(), location.getLongitude()));
Expand Down

0 comments on commit d1fd374

Please sign in to comment.