generic tag editor fix when list field is null. For example PlaceObject3Tag.surfaceFilterList

This commit is contained in:
Honfika
2014-03-25 23:08:34 +01:00
parent 2ca0c18b72
commit 574b618b98

View File

@@ -601,7 +601,16 @@ public class GenericTagTreePanel extends GenericTagPanel {
return 0;
}
Field field = fnode.field;
if (ReflectionTools.needsIndex(field) && (fnode.index == -1)) { //Arrays ot Lists
if (ReflectionTools.needsIndex(field) && (fnode.index == -1)) { //Arrays or Lists
try {
if (field.get(fnode.obj) == null) {
// todo: instanciate the (Array)List or Array to allow adding items to it
return 0;
}
} catch (IllegalArgumentException | IllegalAccessException ex) {
return 0;
}
return ReflectionTools.getFieldSubSize(fnode.obj, field);
}
parent = fnode.getValue();