Skip to content

Commit

Permalink
Check that the collection exists first before trying to add the route.
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Lewis <[email protected]>
  • Loading branch information
jasonlewis committed Jul 14, 2014
1 parent 65edf5a commit bda2e0c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Routing/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,9 @@ protected function addApiRoute($route)
$versions = array_get(last($this->groupStack), 'version', []);

foreach ($versions as $version) {
$this->getApiRouteCollection($version)->add($route);
if ($collection = $this->getApiRouteCollection($version)) {
$collection->add($route);
}
}

return $route;
Expand Down

0 comments on commit bda2e0c

Please sign in to comment.