diff options
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK')
2 files changed, 18 insertions, 8 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java index 079292c512..81d5bcfd8c 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java @@ -372,13 +372,18 @@ public class SymbolLayer extends Layer { if (propertyValue.isExpression()) { return (PropertyValue<String>) propertyValue; } else { + String text = null; + Formatted formatted = (Formatted) nativeGetTextField(); - StringBuilder builder = new StringBuilder(); - for (FormattedSection section : formatted.getFormattedSections()) { - builder.append(section.getText()); + if (formatted != null) { + StringBuilder builder = new StringBuilder(); + for (FormattedSection section : formatted.getFormattedSections()) { + builder.append(section.getText()); + } + text = builder.toString(); } - return (PropertyValue<String>) new PropertyValue("text-field", builder.toString()); + return (PropertyValue<String>) new PropertyValue("text-field", text); } } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs index 0e6cad78f6..c6ae12b028 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs @@ -181,13 +181,18 @@ public class <%- camelize(type) %>Layer extends Layer { if (propertyValue.isExpression()) { return (PropertyValue<String>) propertyValue; } else { + String text = null; + Formatted formatted = (Formatted) nativeGetTextField(); - StringBuilder builder = new StringBuilder(); - for (FormattedSection section : formatted.getFormattedSections()) { - builder.append(section.getText()); + if (formatted != null) { + StringBuilder builder = new StringBuilder(); + for (FormattedSection section : formatted.getFormattedSections()) { + builder.append(section.getText()); + } + text = builder.toString(); } - return (PropertyValue<String>) new PropertyValue("text-field", builder.toString()); + return (PropertyValue<String>) new PropertyValue("text-field", text); } <% } else { -%> return (PropertyValue<<%- propertyType(property) %>>) new PropertyValue("<%- property.name %>", nativeGet<%- camelize(property.name) %>()); |