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
|
@Override
|
||||||
public Entity loadEntity(MapObject mapObject) {
|
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;
|
Amenity amenity = null;
|
||||||
long entityId;
|
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) {
|
if (mapObject instanceof Amenity) {
|
||||||
amenity = (Amenity) mapObject;
|
amenity = (Amenity) mapObject;
|
||||||
entityId = mapObject.getId() >> 1;
|
entityId = mapObject.getId() >> 1;
|
||||||
|
|
|
@ -413,13 +413,12 @@ public class OpenstreetmapRemoteUtil implements OpenstreetmapUtil {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Entity loadEntity(MapObject object) {
|
public Entity loadEntity(MapObject object) {
|
||||||
long objectId = object.getId();
|
Long objectId = object.getId();
|
||||||
boolean isWay = objectId % 2 == 1;// check if mapObject is a way
|
if (!(objectId != null && objectId > 0 && (objectId % 2 == 1 || (objectId >> 7) < Integer.MAX_VALUE))) {
|
||||||
long entityId;
|
|
||||||
if (!(objectId > 0 && (objectId % 2 == 1 || (objectId >> 7) < Integer.MAX_VALUE))) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
boolean isWay = objectId % 2 == 1;// check if mapObject is a way
|
||||||
|
long entityId;
|
||||||
if (object instanceof Amenity) {
|
if (object instanceof Amenity) {
|
||||||
entityId = objectId >> 1;
|
entityId = objectId >> 1;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue