Handle null in runExclusiveAction

This commit is contained in:
Alexander Sytnyk 2017-11-20 14:21:21 +02:00
parent 7d741dc89c
commit 5e21aaf8b4
2 changed files with 3 additions and 4 deletions

View file

@ -643,9 +643,8 @@ public class ContextMenuLayer extends OsmandMapLayer {
}
}
for (Map.Entry<Object, IContextMenuProvider> entry : selectedObjects.entrySet()) {
Object o = entry.getKey();
IContextMenuProvider provider = entry.getValue();
if (o != null && provider != null && provider.runExclusiveAction(o, showUnknownLocation)) {
if (provider != null && provider.runExclusiveAction(entry.getKey(), showUnknownLocation)) {
return true;
}
}
@ -931,7 +930,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
boolean isObjectClickable(Object o);
boolean runExclusiveAction(Object o, boolean unknownLocation);
boolean runExclusiveAction(@Nullable Object o, boolean unknownLocation);
}
public interface IMoveObjectProvider {

View file

@ -483,7 +483,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
@Override
public boolean runExclusiveAction(Object o, boolean unknownLocation) {
if (unknownLocation || !(o instanceof MapMarker)
if (unknownLocation || o == null || !(o instanceof MapMarker)
|| !map.getMyApplication().getSettings().SELECT_MARKER_ON_SINGLE_TAP.get()) {
return false;
}