diff --git a/src/ui/public/visualize/visualize.js b/src/ui/public/visualize/visualize.js index b0654b4c44918..a0c07675da311 100644 --- a/src/ui/public/visualize/visualize.js +++ b/src/ui/public/visualize/visualize.js @@ -76,8 +76,10 @@ uiModules $scope.spy.mode = ($scope.uiState) ? $scope.uiState.get('spy.mode', {}) : {}; let applyClassNames = function () { - let $visEl = getVisContainer(); + const $visEl = getVisContainer(); const $spyEl = getSpyContainer(); + if (!$spyEl) return; + let fullSpy = ($scope.spy.mode && ($scope.spy.mode.fill || $scope.fullScreenSpy)); $visEl.toggleClass('spy-only', Boolean(fullSpy));