Add check for mapObjectId to OpenstreetmapLocalUtil
This commit is contained in:
parent
948875cc9a
commit
08a4150101
2 changed files with 9 additions and 6 deletions
|
@ -82,9 +82,13 @@ public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
|
|||
|
||||
@Override
|
||||
public Entity loadEntity(MapObject mapObject) {
|
||||
Long objectId = mapObject.getId();
|
||||
if (!(objectId != null && objectId > 0 && (objectId % 2 == 1 || (objectId >> 7) < Integer.MAX_VALUE))) {
|
||||
return null;
|
||||
}
|
||||
Amenity amenity = null;
|
||||
long entityId;
|
||||
boolean isWay = mapObject.getId() % 2 == 1; // check if mapObject is a way
|
||||
boolean isWay = objectId % 2 == 1; // check if mapObject is a way
|
||||
if (mapObject instanceof Amenity) {
|
||||
amenity = (Amenity) mapObject;
|
||||
entityId = mapObject.getId() >> 1;
|
||||
|
|
|
@ -413,13 +413,12 @@ public class OpenstreetmapRemoteUtil implements OpenstreetmapUtil {
|
|||
|
||||
@Override
|
||||
public Entity loadEntity(MapObject object) {
|
||||
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))) {
|
||||
Long objectId = object.getId();
|
||||
if (!(objectId != null && objectId > 0 && (objectId % 2 == 1 || (objectId >> 7) < Integer.MAX_VALUE))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
boolean isWay = objectId % 2 == 1;// check if mapObject is a way
|
||||
long entityId;
|
||||
if (object instanceof Amenity) {
|
||||
entityId = objectId >> 1;
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue