diff options
Diffstat (limited to 'javax/swing/SizeSequence.java')
-rw-r--r-- | javax/swing/SizeSequence.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/javax/swing/SizeSequence.java b/javax/swing/SizeSequence.java index a5f34710c..cb6c8bc25 100644 --- a/javax/swing/SizeSequence.java +++ b/javax/swing/SizeSequence.java @@ -129,14 +129,18 @@ public class SizeSequence } /** - * Returns the size of the specified element. + * Returns the size of the specified element, or 0 if the element index is + * outside the defined range. * * @param index the element index. * - * @return The size of the specified element. + * @return The size of the specified element, or 0 if the element index is + * outside the defined range. */ public int getSize(int index) { + if (index < 0 || index >= sizes.length) + return 0; return sizes[index]; } |