diff options
author | Tobrun <tobrun.van.nuland@gmail.com> | 2016-10-24 10:34:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-24 10:34:40 +0200 |
commit | bc4cf3220c0baf74cb771388f7fb216fc29ed8fe (patch) | |
tree | 1b9336048d54679b1c28f721ca039fffb38df5e9 | |
parent | eb1b385e50f783e33bb500693977f7bf45f4126e (diff) | |
download | qtlocation-mapboxgl-bc4cf3220c0baf74cb771388f7fb216fc29ed8fe.tar.gz |
[android] - cap width/height at maximum, don't throw exception. (#6788)
-rwxr-xr-x | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java index 7753787fd6..4e0ce33c5b 100755 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java @@ -9,12 +9,14 @@ import android.os.Build; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.util.DisplayMetrics; +import android.util.Log; import android.view.Surface; import com.mapbox.mapboxsdk.annotations.Icon; import com.mapbox.mapboxsdk.annotations.Marker; import com.mapbox.mapboxsdk.annotations.Polygon; import com.mapbox.mapboxsdk.annotations.Polyline; +import com.mapbox.mapboxsdk.constants.MapboxConstants; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.geometry.ProjectedMeters; import com.mapbox.mapboxsdk.offline.OfflineManager; @@ -151,13 +153,17 @@ final class NativeMapView { } if (width > 65535) { - throw new IllegalArgumentException( - "width cannot be greater than 65535."); + // we have seen edge cases where devices return incorrect values #6111 + Log.e(MapboxConstants.TAG, "Device returned an out of range width size, " + + "capping value at 65535 instead of " + width); + width = 65535; } if (height > 65535) { - throw new IllegalArgumentException( - "height cannot be greater than 65535."); + // we have seen edge cases where devices return incorrect values #6111 + Log.e(MapboxConstants.TAG, "Device returned an out of range height size, " + + "capping value at 65535 instead of " + height); + height = 65535; } nativeViewResize(nativeMapViewPtr, width, height); } |