Skip to content

Commit

Permalink
Add check for nullable $e->sourceName
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomix3D committed Jan 25, 2021
1 parent 3d20a57 commit b6f3d51
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Bridges/Tracy/BlueScreenPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static function initialize(BlueScreen $blueScreen = null): void

public static function renderError(?\Throwable $e): ?array
{
if ($e instanceof Latte\CompileException) {
if ($e instanceof Latte\CompileException && $e->sourceName) {
return [
'tab' => 'Template',
'panel' => (preg_match('#\n|\?#', $e->sourceName)
Expand Down Expand Up @@ -70,6 +70,7 @@ public static function renderUnknownMacro(?\Throwable $e): ?array
{
if (
$e instanceof Latte\CompileException
&& $e->sourceName
&& @is_file($e->sourceName) // @ - may trigger error
&& (preg_match('#Unknown tag (\{\w+)\}, did you mean (\{\w+)\}\?#A', $e->getMessage(), $m)
|| preg_match('#Unknown attribute (n:\w+), did you mean (n:\w+)\?#A', $e->getMessage(), $m))
Expand Down

0 comments on commit b6f3d51

Please sign in to comment.