]> source.dussan.org Git - vaadin-framework.git/commitdiff
table fix: check for empty table came too late
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Wed, 7 Mar 2007 10:48:52 +0000 (10:48 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Wed, 7 Mar 2007 10:48:52 +0000 (10:48 +0000)
svn changeset:808/svn branch:trunk

src/com/itmill/toolkit/ui/Table.java

index 211fa8d3ea4489663f493fa9bb689daacfda378a..c9cbcb8ba805a83a535574920e9b0ac498720e7f 100644 (file)
@@ -1561,6 +1561,10 @@ public class Table extends Select implements Action.Container,
                firstIndex = reqFirstRowToPaint;
         if (rows + firstIndex > size()) rows = size() - firstIndex;
 
+        Object[][] cells = new Object[cols + CELL_FIRSTCOL][rows];
+        if (rows == 0)
+            return cells;
+
         // Get first item id
         if (items instanceof Container.Indexed) 
                id = ((Container.Indexed) items).getIdByIndex(firstIndex);
@@ -1569,9 +1573,6 @@ public class Table extends Select implements Action.Container,
                for (int i=0; i<firstIndex; i++) id = ((Container.Ordered) items).nextItemId(id);
         }
 
-        Object[][] cells = new Object[cols + CELL_FIRSTCOL][rows];
-        if (rows == 0)
-            return cells;
         int headmode = getRowHeaderMode();
         boolean[] iscomponent = new boolean[cols];
         for (int i = 0; i < cols; i++)