Add check for mapObjectId
This commit is contained in:
parent
8e9044652d
commit
948875cc9a
2 changed files with 6 additions and 1 deletions
|
@ -416,6 +416,10 @@ public class OpenstreetmapRemoteUtil implements OpenstreetmapUtil {
|
|||
long objectId = object.getId();
|
||||
boolean isWay = objectId % 2 == 1;// check if mapObject is a way
|
||||
long entityId;
|
||||
if (!(objectId > 0 && (objectId % 2 == 1 || (objectId >> 7) < Integer.MAX_VALUE))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (object instanceof Amenity) {
|
||||
entityId = objectId >> 1;
|
||||
} else {
|
||||
|
|
|
@ -222,7 +222,8 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
final PoiType poiType = amenity.getType().getPoiTypeByKeyName(amenity.getSubType());
|
||||
isEditable = !amenity.getType().isWiki() && poiType !=null && !poiType.isNotEditableOsm();
|
||||
} else if (selectedObj instanceof MapObject) {
|
||||
isEditable = true;
|
||||
Long objectId = ((MapObject) selectedObj).getId();
|
||||
isEditable = objectId != null && objectId > 0 && (objectId % 2 == 1 || (objectId >> 7) < Integer.MAX_VALUE);
|
||||
}
|
||||
if (isEditable) {
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.poi_context_menu_modify, mapActivity)
|
||||
|
|
Loading…
Reference in a new issue