[android] Fix FeatureId check in MapObject

This commit fix the way `FeatureId` is checked in `MapObject.equals()`.

Instead of checking if `mFeatureId` and `other.getFeatureId()` are not `FeatureId.EMPTY`, it now uses a new `isRealId()` method in `FeatureId` to determine if the IDs are valid for comparison.

The `isRealId()` method checks if the `mMwmName` is not empty, `mMwmVersion` is greater than 0, and `mFeatureIndex` is greater than 0. This provides a more robust check for valid feature IDs.

Signed-off-by: Mihail Mitrofanov <mitrofanov@bitrix.ru>
This commit is contained in:
Mihail Mitrofanov
2025-05-19 11:08:47 +02:00
committed by Konstantin Pastbin
parent 964065a7b6
commit 2a2eb9dfc9
2 changed files with 7 additions and 1 deletions

View File

@@ -93,6 +93,12 @@ public class FeatureId implements Parcelable
return mFeatureIndex;
}
public boolean isRealId() {
return !TextUtils.isEmpty(mMwmName) &&
mMwmVersion >= 0 &&
mFeatureIndex > 0;
}
@Override
public boolean equals(Object o)
{

View File

@@ -178,7 +178,7 @@ public class MapObject implements PlacePageData
if (getClass() != other.getClass())
return false;
if (mFeatureId != FeatureId.EMPTY && other.getFeatureId() != FeatureId.EMPTY)
if (mFeatureId.isRealId() && other.getFeatureId().isRealId())
return mFeatureId.equals(other.getFeatureId());
return Double.doubleToLongBits(mLon) == Double.doubleToLongBits(other.mLon) &&