From 19b020dbc72b9aeb5d6e3faca95bb55ce5418bb5 Mon Sep 17 00:00:00 2001 From: Matthew Petroff Date: Mon, 31 Dec 2018 14:36:39 -0500 Subject: [PATCH] Check to make sure hot spot div exists before deleting it (#702). --- src/js/pannellum.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/js/pannellum.js b/src/js/pannellum.js index 3d1fb33..fb5bebb 100644 --- a/src/js/pannellum.js +++ b/src/js/pannellum.js @@ -1784,10 +1784,12 @@ function destroyHotSpots() { if (hs) { for (var i = 0; i < hs.length; i++) { var current = hs[i].div; - while(current.parentNode != renderContainer) { - current = current.parentNode; + if (current) { + while(current.parentNode != renderContainer) { + current = current.parentNode; + } + renderContainer.removeChild(current); } - renderContainer.removeChild(current); delete hs[i].div; } }