Fix index out of bounds exceptions

This commit is contained in:
Alexander Sytnyk 2017-10-20 11:58:52 +03:00
parent 1e2e23c059
commit ad47ca4483
2 changed files with 6 additions and 0 deletions

View file

@ -55,6 +55,9 @@ public class MapMarkersActiveFragment extends Fragment implements OsmAndCompassL
@Override
public void onItemClick(View view) {
int pos = recyclerView.getChildAdapterPosition(view);
if (pos == RecyclerView.NO_POSITION) {
return;
}
MapMarker marker = adapter.getItem(pos);
mapActivity.getMyApplication().getSettings().setMapLocationToShow(marker.getLatitude(), marker.getLongitude(),
15, marker.getPointDescription(mapActivity), true, marker);

View file

@ -184,6 +184,9 @@ public class MapMarkersHistoryFragment extends Fragment implements MapMarkersHel
@Override
public void onItemClick(View view) {
int pos = recyclerView.getChildAdapterPosition(view);
if (pos == RecyclerView.NO_POSITION) {
return;
}
Object item = adapter.getItem(pos);
if (item instanceof MapMarker) {
MapMarker marker = (MapMarker) item;