From 2d54ee16eb8838076625c0ecb7f6834a49c074a3 Mon Sep 17 00:00:00 2001 From: Tankred Hase Date: Thu, 24 Apr 2014 17:54:14 +0200 Subject: [PATCH] Fix bug in loadVisibleBodies loop --- src/js/controller/mail-list.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/js/controller/mail-list.js b/src/js/controller/mail-list.js index b637929..d1dd7fd 100644 --- a/src/js/controller/mail-list.js +++ b/src/js/controller/mail-list.js @@ -425,6 +425,10 @@ define(function(require) { // the n-th message model in the filteredMessages array listItem = listItems.item(i).getBoundingClientRect(); message = scope.filteredMessages[i]; + if (!message) { + // stop if i get larger than the size of filtered messages + break; + } isPartiallyVisibleTop = listItem.top < top && listItem.bottom > top; // a portion of the list item is visible on the top isPartiallyVisibleBottom = listItem.top < bottom && listItem.bottom > bottom; // a portion of the list item is visible on the bottom