         if (y < 0)
             return -1;
         
+        var index:int;
+        
         if (!isNaN(fixedRowHeight))
-            return y / (fixedRowHeight + rowGap);
+        {
+            index = y / (fixedRowHeight + rowGap);
+            return index < _rowCount ? index : -1;
+        }
         
         if (rowList.length == 0)
-            return y / (defaultRowHeight + rowGap);
+        {
+            index = y / (defaultRowHeight + rowGap);
+            return index < _rowCount ? index : -1;
+        }
         
         if (y == 0)
-            return 0;
+            return _rowCount > 0 ? 0 : -1;
         
         // initialize first node.
         if (!recentNode)

{
import flash.geom.Rectangle;

import mx.events.CollectionEvent;
import mx.events.CollectionEventKind;
import mx.collections.IList;

public class GridDimensions 
{

        else
            index = getNextRowIndexAt(y, recentNode, startY);
        
        return index < _rowCount ? index : -1;
    }
    
    /**
