Skip to content

Commit 56da6e2

Browse files
committed
Check whether stack is non-empty before popping (exception and other listeners can stop event propagation)
1 parent 682b09d commit 56da6e2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Bridge/RequestSpanListener.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ public function getOperationName(Request $request)
5757

5858
public function onResponse(FilterResponseEvent $event)
5959
{
60+
if ($this->spans->isEmpty()) {
61+
62+
return $this;
63+
}
64+
6065
$this->tracer->finish(
6166
$this->spans->pop()->addTag(new HttpCodeTag($event->getResponse()->getStatusCode()))
6267
);

0 commit comments

Comments
 (0)