[android] - cap width/height at maximum, don't throw exception. (#6788)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user