diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapDataObject.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapDataObject.java index 3d18a662f5..fda5b39956 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapDataObject.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapDataObject.java @@ -65,6 +65,9 @@ public class BinaryMapDataObject { } public Map getOrderedObjectNames() { + if (namesOrder == null) { + return null; + } LinkedHashMap lm = new LinkedHashMap (); for (int i = 0; i < namesOrder.size(); i++) { int nm = namesOrder.get(i); @@ -240,14 +243,18 @@ public class BinaryMapDataObject { } } if(equals) { - // here we now that name indexes are equal & it is enough to check the value sets + // here we know that name indexes are equal & it is enough to check the value sets if(objectNames == null || thatObj.objectNames == null) { equals = objectNames == thatObj.objectNames; } else if(objectNames.size() != thatObj.objectNames.size()){ equals = false; } else { - TreeSet st = new TreeSet(Arrays.asList(objectNames.values())); - TreeSet ot = new TreeSet(Arrays.asList(thatObj.objectNames.values())); + Object[] thisNames = objectNames.values(); + Object[] thatNames = thatObj.objectNames.values(); + String[] thisStrings = Arrays.copyOf(thisNames, thisNames.length, String[].class); + String[] thatStrings = Arrays.copyOf(thatNames, thatNames.length, String[].class); + TreeSet st = new TreeSet(Arrays.asList(thisStrings)); + TreeSet ot = new TreeSet(Arrays.asList(thatStrings)); equals = st.equals(ot); } } diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java index 7964c4eb94..0086ed7950 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java @@ -1762,7 +1762,7 @@ public class BinaryMapIndexReader { } public void finishInitializingTags() { - int free = decodingRules.size() * 2 + 1; + int free = decodingRules.size(); coastlineBrokenEncodingType = free++; initMapEncodingRule(0, coastlineBrokenEncodingType, "natural", "coastline_broken"); if (landEncodingType == -1) {