Skip to content

Commit de33f9c

Browse files
authored
Make sure we always have a stack (#134)
* Make sure we always have a stack * cs * style update
1 parent 3384d0b commit de33f9c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Collector/Collector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function getStacks()
6262
}
6363

6464
/**
65-
* @return Stack
65+
* @return Stack|bool false if no current stack.
6666
*/
6767
public function getCurrentStack()
6868
{

Collector/ProfilePlugin.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ public function handleRequest(RequestInterface $request, callable $next, callabl
5858
{
5959
$profile = new Profile($this->pluginName, $this->formatter->formatRequest($request));
6060

61-
$this->collector->getCurrentStack()->addProfile($profile);
61+
if ($stack = $this->collector->getCurrentStack()) {
62+
$stack->addProfile($profile);
63+
}
6264

6365
return $this->plugin->handleRequest($request, $next, $first)->then(function (ResponseInterface $response) use ($profile) {
6466
$profile->setResponse($this->formatter->formatResponse($response));

0 commit comments

Comments
 (0)