Tag transform: check theme existence, #420

This commit is contained in:
Emux 2018-10-21 17:27:58 +03:00
parent 292c092be3
commit 6a2b2afdba
No known key found for this signature in database
GPG Key ID: 64ED9980896038C3
2 changed files with 4 additions and 2 deletions

View File

@ -66,7 +66,7 @@ public class MapElement extends GeometryBuffer {
* @return height in meters, if present * @return height in meters, if present
*/ */
public Float getHeight(IRenderTheme theme) { public Float getHeight(IRenderTheme theme) {
String res = theme.transformKey(Tag.KEY_HEIGHT); String res = theme != null ? theme.transformKey(Tag.KEY_HEIGHT) : Tag.KEY_HEIGHT;
String v = tags.getValue(res != null ? res : Tag.KEY_HEIGHT); String v = tags.getValue(res != null ? res : Tag.KEY_HEIGHT);
if (v != null) if (v != null)
return Float.parseFloat(v); return Float.parseFloat(v);
@ -77,7 +77,7 @@ public class MapElement extends GeometryBuffer {
* @return minimum height in meters, if present * @return minimum height in meters, if present
*/ */
public Float getMinHeight(IRenderTheme theme) { public Float getMinHeight(IRenderTheme theme) {
String res = theme.transformKey(Tag.KEY_MIN_HEIGHT); String res = theme != null ? theme.transformKey(Tag.KEY_MIN_HEIGHT) : Tag.KEY_MIN_HEIGHT;
String v = tags.getValue(res != null ? res : Tag.KEY_MIN_HEIGHT); String v = tags.getValue(res != null ? res : Tag.KEY_MIN_HEIGHT);
if (v != null) if (v != null)
return Float.parseFloat(v); return Float.parseFloat(v);

View File

@ -244,6 +244,8 @@ public class BuildingLayer extends Layer implements TileLoaderThemeHook, ZoomLim
} }
protected String getKeyOrDefault(String key) { protected String getKeyOrDefault(String key) {
if (mRenderTheme == null)
return key;
String res = mRenderTheme.transformKey(key); String res = mRenderTheme.transformKey(key);
return res != null ? res : key; return res != null ? res : key;
} }