From 69c338c728680a81a10e24aa14d6eb2b59278b48 Mon Sep 17 00:00:00 2001 From: David Huynh Date: Mon, 11 Oct 2010 23:15:13 +0000 Subject: [PATCH] Text filter was throwing an exception if the column went away (which happened when the column got split). git-svn-id: http://google-refine.googlecode.com/svn/trunk@1464 7d457c2a-affb-35e4-300a-418c747d4874 --- .../com/google/refine/browsing/facets/TextSearchFacet.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main/src/com/google/refine/browsing/facets/TextSearchFacet.java b/main/src/com/google/refine/browsing/facets/TextSearchFacet.java index 958d075a2..fd066c41c 100644 --- a/main/src/com/google/refine/browsing/facets/TextSearchFacet.java +++ b/main/src/com/google/refine/browsing/facets/TextSearchFacet.java @@ -15,6 +15,7 @@ import com.google.refine.browsing.filters.AnyRowRecordFilter; import com.google.refine.browsing.filters.ExpressionStringComparisonRowFilter; import com.google.refine.expr.Evaluable; import com.google.refine.grel.ast.VariableExpr; +import com.google.refine.model.Column; import com.google.refine.model.Project; public class TextSearchFacet implements Facet { @@ -54,7 +55,8 @@ public class TextSearchFacet implements Facet { _name = o.getString("name"); _columnName = o.getString("columnName"); - _cellIndex = project.columnModel.getColumnByName(_columnName).getCellIndex(); + Column column = project.columnModel.getColumnByName(_columnName); + _cellIndex = column != null ? column.getCellIndex() : -1; if (!o.isNull("query")) { _query = o.getString("query"); @@ -79,7 +81,7 @@ public class TextSearchFacet implements Facet { @Override public RowFilter getRowFilter(Project project) { - if (_query == null || _query.length() == 0) { + if (_query == null || _query.length() == 0 || _cellIndex < 0) { return null; } else if ("regex".equals(_mode) && _pattern == null) { return null;