From e42541b1c92ebcc7c34ada2035dec280f99c188a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bar=C3=A1=C5=A1ek?= Date: Fri, 13 Sep 2019 11:39:39 +0200 Subject: [PATCH] Bridge: Template line can be null. (#384) --- src/Bridges/Nette/Bridge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bridges/Nette/Bridge.php b/src/Bridges/Nette/Bridge.php index 407662ab8..d57d197b6 100644 --- a/src/Bridges/Nette/Bridge.php +++ b/src/Bridges/Nette/Bridge.php @@ -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' => '

File: ' . Helpers::editorLink($templateFile, $templateLine) . '

'