                         adjustBuffer()
 
                   else
-                    if !shouldLoadTop()
+                    if buffer.length && !shouldLoadTop()
                       finalize()
                     else
                       #console.log "prepending... requested #{size} records starting from #{start}"

                    buffer[0].element.offset().top - canvas.offset().top > viewport.scrollTop() - bufferPadding()

                clipTop = ->
                  # clip off the invisible items form the top
                  topHeight = topPadding.height()
                  overage = 0
                  for item in buffer

    ])

  .directive( 'ngScroll'
    [ '$log', '$injector'
      (console, $injector) ->
        require: ['?^ngScrollViewport', '?^ngScrollCanvas']
        transclude: 'element'
        priority: 1000
