From 39590a6b00fa5acfdfc7e5218b8a2bf8a2276ebf Mon Sep 17 00:00:00 2001 From: mko Date: Tue, 17 Mar 2015 03:17:30 +0100 Subject: [PATCH] Fix unexpected 'undefined' path Added missing checks of (optional and uninitialized) basePath attribute of config.multiRes. So default basePath/ tourConfig's basePath and multires basePath are the same if there is no explicit setting. --- src/js/pannellum.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/js/pannellum.js b/src/js/pannellum.js index e563647..102c597 100644 --- a/src/js/pannellum.js +++ b/src/js/pannellum.js @@ -193,10 +193,14 @@ function init() { infoDisplay.load.lbar.style.display = 'none'; } else if (config.type == 'multires') { var c = JSON.parse(JSON.stringify(config.multiRes)); // Deep copy - if (config.basePath) { + if (config.basePath && config.multiRes.basePath) { // avoid 'undefined' in path, check (optional) multiRes.basePath, too c.basePath = config.basePath + config.multiRes.basePath; - } else if (tourConfig.basePath) { + } else if (config.basePath) { + c.basePath = config.basePath; + } else if (tourConfig.basePath && config.multiRes.basePath) { // avoid 'undefined' in path, check (optional) multiRes.basePath, too c.basePath = tourConfig.basePath + config.multiRes.basePath; + } else if (tourConfig.basePath) { + c.basePath = tourConfig.basePath; } panoImage = c; } else {