Skip to content

Commit 8f477c6

Browse files
committed
fix route to be null on streaming: "getController()" because "route" is null"
1 parent 4abb9de commit 8f477c6

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/main/java/fr/adrienbrault/idea/symfony2plugin/routing/RouteHelper.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,13 @@ public static Collection<Route> findRoutesByPath(@NotNull Project project, @NotN
160160
public static Collection<Pair<Route, PsiElement>> getMethodsForPathWithPlaceholderMatchRoutes(@NotNull Project project, @NotNull String searchPath) {
161161
Collection<Pair<Route, PsiElement>> targets = new ArrayList<>();
162162

163-
getRoutesForPathWithPlaceholderMatch(project, searchPath)
164-
.forEach(route -> targets.addAll(
165-
Arrays.stream(getMethodsOnControllerShortcut(project, route.getController()))
166-
.map(psiElement -> new Pair<>(route, psiElement))
167-
.toList()
168-
)
169-
);
163+
for (Route route : getRoutesForPathWithPlaceholderMatch(project, searchPath)) {
164+
List<Pair<Route, PsiElement>> list = Arrays.stream(getMethodsOnControllerShortcut(project, route.getController()))
165+
.map(psiElement -> new Pair<>(route, psiElement))
166+
.toList();
167+
168+
targets.addAll(list);
169+
}
170170

171171
return targets;
172172
}
@@ -202,7 +202,7 @@ public static Collection<Route> getRoutesForPathWithPlaceholderMatch(@NotNull Pr
202202
RouteHelper.getAllRoutes(project).values()
203203
.parallelStream()
204204
.forEach(route -> {
205-
if (isReverseRoutePatternMatch(route, searchPath)) {
205+
if (route != null && isReverseRoutePatternMatch(route, searchPath)) {
206206
targets.add(route);
207207
}
208208
});

0 commit comments

Comments
 (0)