diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersItemTouchHelperCallback.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersItemTouchHelperCallback.java index 32f08e9e0d..8a4d1c0285 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersItemTouchHelperCallback.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersItemTouchHelperCallback.java @@ -88,7 +88,12 @@ public class MapMarkersItemTouchHelperCallback extends ItemTouchHelper.Callback @Override public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder source, RecyclerView.ViewHolder target) { - return adapter.onItemMove(source.getAdapterPosition(), target.getAdapterPosition()); + int from = source.getAdapterPosition(); + int to = target.getAdapterPosition(); + if (from == RecyclerView.NO_POSITION || to == RecyclerView.NO_POSITION) { + return false; + } + return adapter.onItemMove(from, to); } @Override