From 13f2ebe9fcb3188b7093967e6f96f8ecf79731db Mon Sep 17 00:00:00 2001 From: Owen Stephens Date: Thu, 10 May 2018 16:37:38 -0400 Subject: [PATCH] Always return null on attempt to get non-existent field, even from null --- main/src/com/google/refine/grel/ast/FieldAccessorExpr.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main/src/com/google/refine/grel/ast/FieldAccessorExpr.java b/main/src/com/google/refine/grel/ast/FieldAccessorExpr.java index 7564accf9..13baf2021 100644 --- a/main/src/com/google/refine/grel/ast/FieldAccessorExpr.java +++ b/main/src/com/google/refine/grel/ast/FieldAccessorExpr.java @@ -63,17 +63,17 @@ public class FieldAccessorExpr implements Evaluable { if (ExpressionUtils.isError(o)) { return o; // bubble the error up } else if (o == null) { - return new EvalError("Cannot retrieve field from null"); + return null; } else if (o instanceof HasFields) { return ((HasFields) o).getField(_fieldName, bindings); } else if (o instanceof JSONObject) { try { return ((JSONObject) o).get(_fieldName); } catch (JSONException e) { - return new EvalError("Object does not have any field, including " + _fieldName); + return null; } } else { - return new EvalError("Object does not have any field, including " + _fieldName); + return null; } }