From 2c94917fb8d32cbe41828452df0b4b3779abc429 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Thu, 13 Jul 2017 12:58:47 -0700 Subject: [PATCH] Add necessary button protection --- .../marketplace/spectator-camera/spectatorCamera.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/unpublishedScripts/marketplace/spectator-camera/spectatorCamera.js b/unpublishedScripts/marketplace/spectator-camera/spectatorCamera.js index 5c5eb5f33b..f0b943ad92 100644 --- a/unpublishedScripts/marketplace/spectator-camera/spectatorCamera.js +++ b/unpublishedScripts/marketplace/spectator-camera/spectatorCamera.js @@ -109,12 +109,13 @@ // from the "Window.domainChanged()" signal. var WAIT_AFTER_DOMAIN_SWITCH_BEFORE_CAMERA_DELETE_MS = 1 * 1000; function spectatorCameraOff(isChangingDomains) { - function deleteCamera() { Entities.deleteEntity(camera); camera = false; - // Change button to active when window is first openend OR if the camera is on, false otherwise. - button.editProperties({ isActive: onSpectatorCameraScreen || camera }); + if (button) { + // Change button to active when window is first openend OR if the camera is on, false otherwise. + button.editProperties({ isActive: onSpectatorCameraScreen || camera }); + } } spectatorCameraConfig.attachedEntityId = false;