Skip to content

Commit e24f9ef

Browse files
committed
Reorganize code in EagerTagFactory to avoid error-prone bug
1 parent c28c28f commit e24f9ef

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/main/java/com/hubspot/jinjava/lib/tag/eager/EagerTagFactory.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,11 @@ public static <T extends Tag> Optional<EagerTagDecorator<T>> getEagerTagDecorato
6363
if (TAG_CLASSES_TO_SKIP.contains(clazz)) {
6464
return Optional.empty();
6565
}
66-
if (EAGER_TAG_OVERRIDES.containsKey(clazz)) {
67-
EagerTagDecorator<?> decorator = EAGER_TAG_OVERRIDES
68-
.get(clazz)
66+
Class<? extends EagerTagDecorator<? extends Tag>> eagerOverrideClass = EAGER_TAG_OVERRIDES.get(
67+
clazz
68+
);
69+
if (eagerOverrideClass != null) {
70+
EagerTagDecorator<?> decorator = eagerOverrideClass
6971
.getDeclaredConstructor(clazz)
7072
.newInstance(tag);
7173
if (decorator.getTag().getClass() == clazz) {

0 commit comments

Comments
 (0)