diff --git a/src/js/pannellum.js b/src/js/pannellum.js
index <HASH>..<HASH> 100644
--- a/src/js/pannellum.js
+++ b/src/js/pannellum.js
@@ -1785,7 +1785,7 @@ function destroyHotSpots() {
         for (var i = 0; i < hs.length; i++) {
             var current = hs[i].div;
             if (current) {
-                while(current.parentNode != renderContainer) {
+                while (current.parentNode && current.parentNode != renderContainer) {
                     current = current.parentNode;
                 }
                 renderContainer.removeChild(current);
Another check to make sure hot spot div exists before deleting it (#<I>).