From 53568ba239a025e44095a9fcd6ce59bbc99620e3 Mon Sep 17 00:00:00 2001 From: Didac Date: Tue, 5 May 2015 18:12:17 +0200 Subject: [PATCH] Fix undefined error when moving too fast If we are switching from one image to another too fast, oldRenderer is undefined at that point. This fix that. --- src/js/pannellum.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/js/pannellum.js b/src/js/pannellum.js index b9bdd68..a151dda 100644 --- a/src/js/pannellum.js +++ b/src/js/pannellum.js @@ -948,7 +948,9 @@ function renderInitCallback() { oldRenderer.fadeImg.style.opacity = 0; // Remove image setTimeout(function() { - renderContainer.removeChild(oldRenderer.fadeImg); + if(oldRenderer && oldRenderer.fadeImg){ + renderContainer.removeChild(oldRenderer.fadeImg); + } oldRenderer = undefined; }, config.sceneFadeDuration); }