diff --git a/js/angular/controller/scrollController.js b/js/angular/controller/scrollController.js index 79e4f9ba1df..deebdcbf6a2 100644 --- a/js/angular/controller/scrollController.js +++ b/js/angular/controller/scrollController.js @@ -108,12 +108,18 @@ function($scope, self.scrollTop = function(shouldAnimate) { self.resize().then(function() { + if (!scrollView) { + return; + } scrollView.scrollTo(0, 0, !!shouldAnimate); }); }; self.scrollBottom = function(shouldAnimate) { self.resize().then(function() { + if (!scrollView) { + return; + } var max = scrollView.getScrollMax(); scrollView.scrollTo(max.left, max.top, !!shouldAnimate); }); @@ -121,30 +127,45 @@ function($scope, self.scrollTo = function(left, top, shouldAnimate) { self.resize().then(function() { + if (!scrollView) { + return; + } scrollView.scrollTo(left, top, !!shouldAnimate); }); }; self.zoomTo = function(zoom, shouldAnimate, originLeft, originTop) { self.resize().then(function() { + if (!scrollView) { + return; + } scrollView.zoomTo(zoom, !!shouldAnimate, originLeft, originTop); }); }; self.zoomBy = function(zoom, shouldAnimate, originLeft, originTop) { self.resize().then(function() { + if (!scrollView) { + return; + } scrollView.zoomBy(zoom, !!shouldAnimate, originLeft, originTop); }); }; self.scrollBy = function(left, top, shouldAnimate) { self.resize().then(function() { + if (!scrollView) { + return; + } scrollView.scrollBy(left, top, !!shouldAnimate); }); }; self.anchorScroll = function(shouldAnimate) { self.resize().then(function() { + if (!scrollView) { + return; + } var hash = $location.hash(); var elm = hash && $document[0].getElementById(hash); if (!(hash && elm)) {