Skip to content

Commit 34d8068

Browse files
authored
Avoid uninitialized use of Stracktrace builder
1 parent d5cb8b2 commit 34d8068

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Classes/SentryClient.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class SentryClient
5353
protected string $release;
5454
protected float $sampleRate;
5555
protected array $excludeExceptionTypes = [];
56-
protected StacktraceBuilder $stacktraceBuilder;
56+
protected ?StacktraceBuilder $stacktraceBuilder = null;
5757

5858
/**
5959
* @Flow\Inject
@@ -282,8 +282,12 @@ private function renderCleanPathAndFilename(string $rawPathAndFilename): string
282282
return str_replace(['_', FLOW_PATH_ROOT], '/', $matches[1]);
283283
}
284284

285-
private function prepareStacktrace(\Throwable $throwable = null): Stacktrace
285+
private function prepareStacktrace(\Throwable $throwable = null): ?Stacktrace
286286
{
287+
if ($this->stacktraceBuilder === null) {
288+
return null;
289+
}
290+
287291
if ($throwable) {
288292
$stacktrace = $this->stacktraceBuilder->buildFromException($throwable);
289293
} else {

0 commit comments

Comments
 (0)