diff --git a/js/views_infinite_scroll.js b/js/views_infinite_scroll.js
index 251398b..17abacd 100644
--- a/js/views_infinite_scroll.js
+++ b/js/views_infinite_scroll.js
@@ -72,7 +72,7 @@
         var prev_content_height = $(content_selector).height();
         do {
           var last = $($items).filter(':last');
-          if (last.offset().top + last.height() < $(document).scrollTop() + $(window).height()) {
+          if (last.length>0 && (last.offset().top + last.height() < $(document).scrollTop() + $(window).height())) {
             last = $($items).filter(':last');
             $.autopager('load');
           }
