Skip to content

Commit fce8aad

Browse files
committed
check destroy functions before execution
1 parent 6de0042 commit fce8aad

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

src/traces/scattergl/index.js

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,28 @@ function sceneUpdate(gd, subplot) {
295295

296296
// remove scene resources
297297
scene.destroy = function destroy() {
298-
if(scene.fill2d) scene.fill2d.destroy();
299-
if(scene.scatter2d) scene.scatter2d.destroy();
300-
if(scene.error2d) scene.error2d.destroy();
301-
if(scene.line2d) scene.line2d.destroy();
302-
if(scene.select2d) scene.select2d.destroy();
298+
if((scene.fill2d) &&
299+
(scene.fill2d.destroy))
300+
scene.fill2d.destroy();
301+
if((scene.scatter2d) &&
302+
(scene.scatter2d.destroy))
303+
scene.scatter2d.destroy();
304+
if((scene.error2d) &&
305+
(scene.error2d.destroy))
306+
scene.error2d.destroy();
307+
if((scene.line2d) &&
308+
(scene.line2d.destroy))
309+
scene.line2d.destroy();
310+
if((scene.select2d) &&
311+
(scene.select2d.destroy))
312+
scene.select2d.destroy();
303313
if(scene.glText) {
304-
scene.glText.forEach(function(text) { text.destroy(); });
314+
scene.glText.forEach(
315+
function(text) {
316+
if (text.destroy)
317+
text.destroy();
318+
}
319+
);
305320
}
306321

307322
scene.lineOptions = null;

0 commit comments

Comments
 (0)