diff --git a/OsmAnd-java/src/main/java/net/osmand/data/MapObject.java b/OsmAnd-java/src/main/java/net/osmand/data/MapObject.java index d3700896b2..5fb13d62ac 100644 --- a/OsmAnd-java/src/main/java/net/osmand/data/MapObject.java +++ b/OsmAnd-java/src/main/java/net/osmand/data/MapObject.java @@ -89,23 +89,22 @@ public abstract class MapObject implements Comparable { names.putAll(name); } } - + public Map getNamesMap(boolean includeEn) { - if (!includeEn || Algorithms.isEmpty(enName)) { - if (names == null) { - return Collections.emptyMap(); - } - return names; + if ((!includeEn || Algorithms.isEmpty(enName)) && names == null) { + return Collections.emptyMap(); } Map mp = new HashMap(); if (names != null) { - Iterator> it = mp.entrySet().iterator(); - while(it.hasNext()) { + Iterator> it = names.entrySet().iterator(); + while (it.hasNext()) { Entry e = it.next(); mp.put(e.getKey(), unzipContent(e.getValue())); } } - mp.put("en", unzipContent(enName)); + if (includeEn && !Algorithms.isEmpty(enName)) { + mp.put("en", unzipContent(enName)); + } return mp; } @@ -115,7 +114,7 @@ public abstract class MapObject implements Comparable { l.add(unzipContent(enName)); } if (names != null) { - for(String nm : names.values()) { + for (String nm : names.values()) { l.add(unzipContent(nm)); } }