Skip to content

Commit 8e4684d

Browse files
committed
fix "FormFieldResolver.visitFormReferencesFields must not be null"
1 parent 91c0892 commit 8e4684d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/fr/adrienbrault/idea/symfony2plugin/templating/variable/resolver/FormFieldResolver.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ public void resolve(Collection<TwigTypeContainer> targets, Collection<TwigTypeCo
3434

3535
TwigTypeContainer twigTypeContainer = targets.iterator().next();
3636
if (twigTypeContainer.getPhpNamedElement() instanceof PhpClass phpClass && isFormView(phpClass)) {
37-
visitFormReferencesFields(psiVariables.iterator().next().getElement(), targets::add);
37+
PsiElement element = psiVariables.iterator().next().getElement();
38+
if (element != null) {
39+
visitFormReferencesFields(element, targets::add);
40+
}
3841
}
3942
}
4043

@@ -51,6 +54,7 @@ public static boolean isFormView(@NotNull PhpType phpType) {
5154
);
5255
}
5356

57+
@NotNull
5458
public static Collection<PhpClass> getFormTypeFromFormFactory(@NotNull PsiElement formReference) {
5559
Collection<PhpClass> phpClasses = new ArrayList<>();
5660

0 commit comments

Comments
 (0)