Added null check for onLocationChanged()

This commit is contained in:
misaochan 2016-02-16 15:18:33 +13:00
parent 8a80ea080f
commit 04d441516d

View file

@ -46,7 +46,9 @@ public class GPSExtractor {
locationManager.requestLocationUpdates(provider, 400, 1, myLocationListener); locationManager.requestLocationUpdates(provider, 400, 1, myLocationListener);
Location location = locationManager.getLastKnownLocation(provider); Location location = locationManager.getLastKnownLocation(provider);
myLocationListener.onLocationChanged(location); if (location != null) {
myLocationListener.onLocationChanged(location);
}
} }
protected void unregisterLocationManager() { protected void unregisterLocationManager() {