Skip to content

Commit 459add1

Browse files
authored
Merge pull request #40 from flownative/bugfix/avoid-uninitialized-stracktrace-builder
Avoid uninitialized use of stracktrace builder
2 parents 84e5788 + 34d8068 commit 459add1

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
@@ -54,7 +54,7 @@ class SentryClient
5454

5555
protected float $sampleRate = 1;
5656
protected array $excludeExceptionTypes = [];
57-
protected StacktraceBuilder $stacktraceBuilder;
57+
protected ?StacktraceBuilder $stacktraceBuilder = null;
5858

5959
/**
6060
* @Flow\Inject
@@ -295,8 +295,12 @@ private function renderCleanPathAndFilename(string $rawPathAndFilename): string
295295
return str_replace(['_', FLOW_PATH_ROOT], '/', $matches[1]);
296296
}
297297

298-
private function prepareStacktrace(\Throwable $throwable = null): Stacktrace
298+
private function prepareStacktrace(\Throwable $throwable = null): ?Stacktrace
299299
{
300+
if ($this->stacktraceBuilder === null) {
301+
return null;
302+
}
303+
300304
if ($throwable) {
301305
$stacktrace = $this->stacktraceBuilder->buildFromException($throwable);
302306
} else {

0 commit comments

Comments
 (0)