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:
David Huynh 2010-11-01 18:13:53 +00:00
parent 1eebe2e4a3
commit 1f12bfb409

View File

@ -41,16 +41,18 @@ public class HasFieldsListImpl extends ArrayList<HasFields> implements HasFields
public Object getField(String name, Properties bindings) {
int c = size();
if (c > 0 && get(0).fieldAlsoHasFields(name)) {
if (c > 0 && get(0) != null && get(0).fieldAlsoHasFields(name)) {
HasFieldsListImpl l = new HasFieldsListImpl();
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;
} else {
Object[] r = new Object[this.size()];
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;
}