From 19155c8ed8135c0f7a9120dbc4125a05b5330171 Mon Sep 17 00:00:00 2001 From: Tim Habermaas Date: Fri, 21 Aug 2015 16:50:55 +0200 Subject: [PATCH] Fix undefined errors on show page. --- frontend/app/routing.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/app/routing.js b/frontend/app/routing.js index 14de7f378b..dae35e32c6 100644 --- a/frontend/app/routing.js +++ b/frontend/app/routing.js @@ -37,7 +37,13 @@ angular.module('openproject') (function() { function valToString(val) { return val !== null ? val.toString() : val; } function valFromString(val) { return val !== null ? val.toString() : val; } - function regexpMatches(val) { /*jshint validthis:true */ return this.pattern.test(val); } + function regexpMatches(val) { + /*jshint validthis:true */ + // I'm not really sure why `val` can be undefined here, but undefined errors + // kept appearing after moving the routes around. + // This "fixes" it. Sorry. + return angular.isUndefined(val) ? false : this.pattern.test(val); + } $urlMatcherFactoryProvider.type('projectPathType', { encode: valToString, decode: valFromString,