From 63d1f26e555f5459910e40ec4cb7f862f862324c Mon Sep 17 00:00:00 2001 From: Eugene OZ Date: Tue, 4 Nov 2014 16:07:31 +0300 Subject: [PATCH] Prevent 'cannot read' exception On Android (4.4.4) I'm getting "Cannot read property 'options' of null" each time, 100% reproducible. This small check will not hurt anyone but will prevent unhandled exception error. --- js/angular/controller/scrollController.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/js/angular/controller/scrollController.js b/js/angular/controller/scrollController.js index e5c997c37e..a5d33a9b4c 100644 --- a/js/angular/controller/scrollController.js +++ b/js/angular/controller/scrollController.js @@ -41,14 +41,15 @@ function($scope, scrollViewOptions, $timeout, $window, $$scrollValueCache, $loca if (!angular.isDefined(scrollViewOptions.bouncing)) { ionic.Platform.ready(function() { - scrollView.options.bouncing = true; - - if(ionic.Platform.isAndroid()) { - // No bouncing by default on Android - scrollView.options.bouncing = false; - // Faster scroll decel - scrollView.options.deceleration = 0.95; - } else { + if (scrollView.options) { + scrollView.options.bouncing = true; + if(ionic.Platform.isAndroid()) { + // No bouncing by default on Android + scrollView.options.bouncing = false; + // Faster scroll decel + scrollView.options.deceleration = 0.95; + } else { + } } }); }