[android] verify if text-field is not null before performing compatibility operations

This commit is contained in:
Łukasz Paczos
2018-11-06 12:37:14 +01:00
committed by Łukasz Paczos
parent 39423cc653
commit bb55bae76d
12 changed files with 181 additions and 8 deletions

View File

@@ -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);
}
}

View File

@@ -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) %>());