Fixed bug in HasFieldsListImpl where list members weren't tested for being null.
git-svn-id: http://google-refine.googlecode.com/svn/trunk@1735 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
1eebe2e4a3
commit
1f12bfb409
@ -41,16 +41,18 @@ public class HasFieldsListImpl extends ArrayList<HasFields> implements HasFields
|
|||||||
|
|
||||||
public Object getField(String name, Properties bindings) {
|
public Object getField(String name, Properties bindings) {
|
||||||
int c = size();
|
int c = size();
|
||||||
if (c > 0 && get(0).fieldAlsoHasFields(name)) {
|
if (c > 0 && get(0) != null && get(0).fieldAlsoHasFields(name)) {
|
||||||
HasFieldsListImpl l = new HasFieldsListImpl();
|
HasFieldsListImpl l = new HasFieldsListImpl();
|
||||||
for (int i = 0; i < size(); i++) {
|
for (int i = 0; i < size(); i++) {
|
||||||
l.add(i, (HasFields) this.get(i).getField(name, bindings));
|
HasFields o = this.get(i);
|
||||||
|
l.add(i, o == null ? null : (HasFields) o.getField(name, bindings));
|
||||||
}
|
}
|
||||||
return l;
|
return l;
|
||||||
} else {
|
} else {
|
||||||
Object[] r = new Object[this.size()];
|
Object[] r = new Object[this.size()];
|
||||||
for (int i = 0; i < r.length; i++) {
|
for (int i = 0; i < r.length; i++) {
|
||||||
r[i] = this.get(i).getField(name, bindings);
|
HasFields o = this.get(i);
|
||||||
|
r[i] = o == null ? null : o.getField(name, bindings);
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user