summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/ui/TabSheet.java
diff options
context:
space:
mode:
authorJohannes Dahlström <johannes.dahlstrom@vaadin.com>2012-04-12 15:22:21 +0000
committerJohannes Dahlström <johannes.dahlstrom@vaadin.com>2012-04-12 15:22:21 +0000
commit780c5d6be068cad400e39df6d6b3f5b533d0366c (patch)
tree816439bc5abcf9fc2d13dcf66dae18f96b65423b /src/com/vaadin/ui/TabSheet.java
parent812d41be428701e66fcafa3d20182fb11afc5f99 (diff)
downloadvaadin-framework-780c5d6be068cad400e39df6d6b3f5b533d0366c.tar.gz
vaadin-framework-780c5d6be068cad400e39df6d6b3f5b533d0366c.zip
Fixed #8653: addTab(index) should not throw if index is out of bounds
svn changeset:23503/svn branch:6.8
Diffstat (limited to 'src/com/vaadin/ui/TabSheet.java')
-rw-r--r--src/com/vaadin/ui/TabSheet.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/com/vaadin/ui/TabSheet.java b/src/com/vaadin/ui/TabSheet.java
index cb89c5e0c8..334c4c886b 100644
--- a/src/com/vaadin/ui/TabSheet.java
+++ b/src/com/vaadin/ui/TabSheet.java
@@ -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;
}
/**