[android] Fix style code generation if array default value is missing

This commit is contained in:
Mikhail Pozdnyakov
2019-03-21 17:20:39 +02:00
parent 106e592a55
commit 9fb149b261
2 changed files with 6 additions and 2 deletions

View File

@@ -598,7 +598,7 @@ public class SymbolLayerTest extends BaseLayerTest {
assertNull(layer.getTextVariableAnchor().getValue());
// Set and Get
String[] propertyValue = [undefined];
String[] propertyValue = new String[0];
layer.setProperties(textVariableAnchor(propertyValue));
assertEquals(layer.getTextVariableAnchor().getValue(), propertyValue);
}

View File

@@ -198,7 +198,11 @@ global.defaultValueJava = function(property) {
switch (property.value) {
case 'string':
case 'enum':
return '[' + property['default'] + "]";
if (property['default'] !== undefined) {
return '[' + property['default'] + ']';
} else {
return 'new String[0]';
}
case 'number':
var result ='new Float[] {';
for (var i = 0; i < property.length; i++) {