From 5b9271cffb5b090e65f9bd6f81053a0e711f182a Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Mon, 25 Jun 2012 10:23:46 -0400
Subject: [PATCH] Bug fix: do not modify src if src is unset.

---
 .../src/VuFind/Theme/Root/Helper/HeadScript.php    | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/module/VuFind/src/VuFind/Theme/Root/Helper/HeadScript.php b/module/VuFind/src/VuFind/Theme/Root/Helper/HeadScript.php
index 85dad353b9c..36269252ad9 100644
--- a/module/VuFind/src/VuFind/Theme/Root/Helper/HeadScript.php
+++ b/module/VuFind/src/VuFind/Theme/Root/Helper/HeadScript.php
@@ -52,13 +52,15 @@ class HeadScript extends \Zend\View\Helper\HeadScript
     public function itemToString($item, $indent, $escapeStart, $escapeEnd)
     {
         // Normalize href to account for themes:
-        $relPath = 'js/' . $item->attributes['src'];
-        $currentTheme = ThemeTools::findContainingTheme($relPath);
+        if (!empty($item->attributes['src'])) {
+            $relPath = 'js/' . $item->attributes['src'];
+            $currentTheme = ThemeTools::findContainingTheme($relPath);
 
-        if (!empty($currentTheme)) {
-            $urlHelper = $this->getView()->plugin('url');
-            $item->attributes['src']
-                = $urlHelper('home') . "themes/$currentTheme/" . $relPath;
+            if (!empty($currentTheme)) {
+                $urlHelper = $this->getView()->plugin('url');
+                $item->attributes['src']
+                    = $urlHelper('home') . "themes/$currentTheme/" . $relPath;
+            }
         }
 
         return parent::itemToString($item, $indent, $escapeStart, $escapeEnd);
-- 
GitLab