Author: cbrisson
Date: Fri Sep 23 14:31:00 2016
New Revision: 1762066
URL: http://svn.apache.org/viewvc?rev=1762066&view=rev
Log:
[engine] bugfix when trying to get a property of a null value (introduced in
commit 1752548)
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTReference.java
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTReference.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTReference.java?rev=1762066&r1=1762065&r2=1762066&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTReference.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTReference.java
Fri Sep 23 14:31:00 2016
@@ -247,11 +247,18 @@ public class ASTReference extends Simple
* do not trigger an invalid reference if the reference is
present, but with a null value
* don't either for a quiet reference or inside an #if/#elseif
evaluation context
*/
- if (!context.containsKey(rootString) && referenceType !=
QUIET_REFERENCE && !onlyTestingReference)
+ if (referenceType != QUIET_REFERENCE &&
+ (numChildren > 0 ||
+ !context.containsKey(rootString) &&
!onlyTestingReference))
{
return EventHandlerUtil.invalidGetMethod(rsvc, context,
"$" + rootString, null, null, uberInfo);
}
+
+ /*
+ * otherwise, simply return null
+ */
+ return null;
}
/*