Skip to content

Commit bda2e0c

Browse files
committed
Check that the collection exists first before trying to add the route.
Signed-off-by: Jason Lewis <[email protected]>
1 parent 65edf5a commit bda2e0c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Routing/Router.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,9 @@ protected function addApiRoute($route)
251251
$versions = array_get(last($this->groupStack), 'version', []);
252252

253253
foreach ($versions as $version) {
254-
$this->getApiRouteCollection($version)->add($route);
254+
if ($collection = $this->getApiRouteCollection($version)) {
255+
$collection->add($route);
256+
}
255257
}
256258

257259
return $route;

0 commit comments

Comments
 (0)