Skip to content

Commit

Permalink
Merge pull request #19 from martinlutter/null-request
Browse files Browse the repository at this point in the history
handle null request
  • Loading branch information
klinec authored Mar 14, 2019
2 parents c5e0123 + 8d93fcd commit 1d8bf09
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/Bridge/Item/RequestAttributesContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ public function __construct(RequestStack $requestStack)
$this->request = $requestStack->getMasterRequest();
}

public function get(string $name, string $default = null): string
public function get(string $name, string $default = ''): string
{
if (!$this->request) {
return '';
}

return $this->request->get($name, $default);
}
}
2 changes: 1 addition & 1 deletion src/Bridge/Matcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct(RequestStack $requestStack, UrlMatchVoterInterface $

public function isCurrent($item): bool
{
if (!$item instanceof MatchableInterface) {
if (!$this->request || !$item instanceof MatchableInterface) {
return false;
}

Expand Down

0 comments on commit 1d8bf09

Please sign in to comment.