Change NativeMapView to use 0 instead of throwing IllegalArgumentException when resizeView is called with a negative width or height (#151)

This commit is contained in:
thirstycoda
2021-09-06 17:58:17 +01:00
committed by GitHub
parent 206bca766c
commit f09e9ab660

View File

@@ -150,11 +150,17 @@ final class NativeMapView implements NativeMap {
height = (int) Math.ceil(height / pixelRatio);
if (width < 0) {
throw new IllegalArgumentException("width cannot be negative.");
Logger.e(TAG, String.format("Device returned a negative width size, "
+ "setting value to 0 instead of %s", width)
);
width = 0;
}
if (height < 0) {
throw new IllegalArgumentException("height cannot be negative.");
Logger.e(TAG, String.format("Device returned a negative height size, "
+ "setting value to 0 instead of %s", height)
);
height = 0;
}
if (width > 65535) {