From 08e81cf3c8ee2ccfd6611a6a825e0f56a37847e1 Mon Sep 17 00:00:00 2001
From: Hanne Moa <hanne.moa@uninett.no>
Date: Fri, 4 Mar 2016 12:31:13 +0100
Subject: [PATCH] Decouple template path setup and template existence check

---
 lib/SimpleSAML/XHTML/Template.php | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php
index cc76a3e94..1bad9c98d 100644
--- a/lib/SimpleSAML/XHTML/Template.php
+++ b/lib/SimpleSAML/XHTML/Template.php
@@ -131,9 +131,6 @@ class SimpleSAML_XHTML_Template
         foreach ($templateDirs as $entry) {
             $loader->addPath($entry[key($entry)], key($entry));
         }
-        if (!$loader->exists($this->twig_template)) {
-            return false;
-        }
         return $loader;
     }
 
@@ -151,7 +148,8 @@ class SimpleSAML_XHTML_Template
         }
         // set up template paths
         $loader = $this->setupTwigTemplatepaths();
-        if (!$loader) {
+        // abort if twig template does not exist
+        if (!$loader->exists($this->twig_template)) {
             return null;
         }
 
-- 
GitLab