]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixed #8653: addTab(index) should not throw if index is out of bounds
authorJohannes Dahlström <johannes.dahlstrom@vaadin.com>
Thu, 12 Apr 2012 15:22:21 +0000 (15:22 +0000)
committerJohannes Dahlström <johannes.dahlstrom@vaadin.com>
Thu, 12 Apr 2012 15:22:21 +0000 (15:22 +0000)
svn changeset:23503/svn branch:6.8

src/com/vaadin/ui/TabSheet.java

index cb89c5e0c82fca76d750efbb0ab02e80067e5b26..334c4c886bf2d1ff206dfe0704896426d7e51c76 100644 (file)
@@ -569,14 +569,15 @@ public class TabSheet extends AbstractComponentContainer implements Focusable,
      * 
      * @param position
      *            the position of the tab
-     * @return
+     * @return The tab in the given position, or null if the position is out of
+     *         bounds.
      */
     public Tab getTab(int position) {
-        Component c = components.get(position);
-        if (c != null) {
-            return tabs.get(c);
+        if (position >= 0 && position < getComponentCount()) {
+            return getTab(components.get(position));
+        } else {
+            return null;
         }
-        return null;
     }
 
     /**