Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 7e43c9a

Browse files
authored
Crash when converting screencoordinate as part of moveBy (#555)
* [map] workaround crash that occurs when converting a screencoordinate to location as part of moveBy * [map] fixup lint warning from external provided PR
1 parent 788eca4 commit 7e43c9a

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ public View getRenderView() {
526526
/**
527527
* Add an OnTouchListener which will be call when an event occurs
528528
*
529-
* @param listener
529+
* @param listener listener to be called when touch event occurs
530530
* @return true if listener has been successfully registered
531531
*/
532532
public boolean addOnTouchListener(OnTouchListener listener) {
@@ -536,7 +536,7 @@ public boolean addOnTouchListener(OnTouchListener listener) {
536536
/**
537537
* Remove an OnTouchListener previously registered
538538
*
539-
* @param listener
539+
* @param listener listener to be called when touch event occurs
540540
* @return true if listener has been successfully unregistered
541541
*/
542542
public boolean removeOnTouchListener(OnTouchListener listener) {

MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,14 @@ public void moveBy(double dx, double dy, long duration) {
264264
if (checkState("moveBy")) {
265265
return;
266266
}
267-
nativeMoveBy(dx / pixelRatio, dy / pixelRatio, duration);
267+
268+
try {
269+
nativeMoveBy(dx / pixelRatio, dy / pixelRatio, duration);
270+
} catch (java.lang.Error error) {
271+
// workaround for latitude must not be NaN issue
272+
// which is thrown when gl-native can't convert a screen coordinate to location
273+
Logger.d(TAG, "Error when executing NativeMapView#moveBy", error);
274+
}
268275
}
269276

270277
@Override

0 commit comments

Comments
 (0)