Skip to content

Commit 27e1e81

Browse files
committed
Return null on illegal field acces
issue #940
1 parent ef79693 commit 27e1e81

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

handlebars/src/main/java/com/github/jknack/handlebars/context/FieldValueResolver.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ public boolean matches(final FieldWrapper field, final String name) {
212212
protected Object invokeMember(final FieldWrapper field, final Object context) {
213213
try {
214214
return field.get(context);
215+
} catch (IllegalAccessException ex) {
216+
System.err.println("Illegal access to field '" + field.getName() +
217+
"'. Returning null instead.");
218+
return null;
215219
} catch (Exception ex) {
216220
throw new IllegalStateException(
217221
"Shouldn't be illegal to access field '" + field.getName()

0 commit comments

Comments
 (0)