From 596dfc304dfdf074595fc11e82074d8681e35b5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 20 Feb 2015 10:45:23 +0100 Subject: [PATCH] Added guard for template variables missing query field, Fixes #1501 --- src/app/features/templating/templateSrv.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/app/features/templating/templateSrv.js b/src/app/features/templating/templateSrv.js index c44ff0a5669..8fc45097944 100644 --- a/src/app/features/templating/templateSrv.js +++ b/src/app/features/templating/templateSrv.js @@ -45,6 +45,9 @@ function (angular, _) { }; this.containsVariable = function(str, variableName) { + if (!str) { + return false; + } return str.indexOf('$' + variableName) !== -1 || str.indexOf('[[' + variableName + ']]') !== -1; };