avoid an array out of bounds exception in case there are no columns in the dataset

(I know, it should not happen but when it does let's not barf)


git-svn-id: http://google-refine.googlecode.com/svn/trunk@375 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Stefano Mazzocchi 2010-04-02 20:21:41 +00:00
parent 62f5f21ca3
commit 4eda7ae2c0

View File

@ -100,8 +100,11 @@ public class ColumnModel implements Jsonizable {
} }
writer.endArray(); writer.endArray();
writer.key("keyCellIndex"); writer.value(getKeyColumnIndex()); if (columns.size() > 0) {
writer.key("keyColumnName"); writer.value(columns.get(_keyColumnIndex).getName()); writer.key("keyCellIndex"); writer.value(getKeyColumnIndex());
writer.key("keyColumnName"); writer.value(columns.get(_keyColumnIndex).getName());
}
writer.key("columnGroups"); writer.key("columnGroups");
writer.array(); writer.array();
for (ColumnGroup g : _rootColumnGroups) { for (ColumnGroup g : _rootColumnGroups) {