Skip to content

Commit 7c94417

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

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,13 @@ 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+
// Illegal access to field is expected for classes from external modules
217+
return null;
215218
} catch (Exception ex) {
216219
throw new IllegalStateException(
217-
"Shouldn't be illegal to access field '" + field.getName()
218-
+ "'", ex);
220+
"Shouldn't be illegal to access field '" + field.getName()
221+
+ "'", ex);
219222
}
220223
}
221224

0 commit comments

Comments
 (0)