Skip to content

Commit

Permalink
Bridge: Template line can be null. (#384)
Browse files Browse the repository at this point in the history
  • Loading branch information
janbarasek authored and dg committed Sep 13, 2019
1 parent b4160e3 commit e42541b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Bridges/Nette/Bridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static function renderLatteError(?\Throwable $e): ?array
$lines = file($file);
if (preg_match('#// source: (\S+\.latte)#', $lines[1], $m) && @is_file($m[1])) { // @ - may trigger error
$templateFile = $m[1];
$templateLine = preg_match('#/\* line (\d+) \*/#', $lines[$e->getLine() - 1], $m) ? (int) $m[1] : null;
$templateLine = $e->getLine() && preg_match('#/\* line (\d+) \*/#', $lines[$e->getLine() - 1], $m) ? (int) $m[1] : null;
return [
'tab' => 'Template',
'panel' => '<p><b>File:</b> ' . Helpers::editorLink($templateFile, $templateLine) . '</p>'
Expand Down

0 comments on commit e42541b

Please sign in to comment.