fix a bug where when an error would be thrown through the loader (Twig_Error_Loader by Twig_Loader_Filesystem, ie) the $trace['line'] would not be set (since we're not in a template)

This commit is contained in:
Nami-Doc
2012-03-31 19:45:34 +03:00
parent dfb523eab6
commit 36618fe101
+5 -3
View File
@@ -163,9 +163,11 @@ class Twig_Error extends Exception
protected function guessTemplateLine($trace)
{
foreach ($trace['object']->getDebugInfo() as $codeLine => $templateLine) {
if (isset($trace['line']) && $codeLine <= $trace['line']) {
return $templateLine;
if (isset($trace['line'])) {
foreach ($trace['object']->getDebugInfo() as $codeLine => $templateLine) {
if (isset($trace['line']) && $codeLine <= $trace['line']) {
return $templateLine;
}
}
}