diff options
author | Tobrun <tobrun.van.nuland@gmail.com> | 2016-11-07 14:38:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-07 14:38:04 +0100 |
commit | 5412191ab484cc82f2864fd9cf360939c823fc33 (patch) | |
tree | 952772a31cadd001a5ea98b07fa985b9528306b0 | |
parent | 505bf7db7a33f977a3339528bbae17bdfa30e2e0 (diff) | |
download | qtlocation-mapboxgl-5412191ab484cc82f2864fd9cf360939c823fc33.tar.gz |
[android] - validate intent and contents before handling (#6938)
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/telemetry/TelemetryLocationReceiver.java | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/telemetry/TelemetryLocationReceiver.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/telemetry/TelemetryLocationReceiver.java index c18da41e4b..3e594b530c 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/telemetry/TelemetryLocationReceiver.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/telemetry/TelemetryLocationReceiver.java @@ -6,15 +6,12 @@ import android.content.Intent; import android.location.Location; import android.location.LocationManager; import android.os.Handler; -import android.util.Log; /** * Listener for Location updates generated by implementing app. */ public class TelemetryLocationReceiver extends BroadcastReceiver { - private static final String TAG = "TelemLocationReceiver"; - public static final String INTENT_STRING = "com.mapbox.mapboxsdk.telemetry.TelemetryLocationReceiver"; /** @@ -61,12 +58,14 @@ public class TelemetryLocationReceiver extends BroadcastReceiver { */ @Override public void onReceive(Context context, Intent intent) { - Location location = (Location)intent.getExtras().get(LocationManager.KEY_LOCATION_CHANGED); + if (intent == null || intent.getExtras() == null) { + // see https://github.com/mapbox/mapbox-gl-native/issues/6934 + return; + } + + Location location = (Location) intent.getExtras().get(LocationManager.KEY_LOCATION_CHANGED); if (location != null) { -// Log.d(TAG, "location received = " + location); MapboxEventManager.getMapboxEventManager().addLocationEvent(location); - } else { - Log.d(TAG, "location NOT received"); } } } |