diff options
Diffstat (limited to 'libjava/classpath/javax/swing/SizeSequence.java')
| -rw-r--r-- | libjava/classpath/javax/swing/SizeSequence.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libjava/classpath/javax/swing/SizeSequence.java b/libjava/classpath/javax/swing/SizeSequence.java index a5f34710c76..cb6c8bc25df 100644 --- a/libjava/classpath/javax/swing/SizeSequence.java +++ b/libjava/classpath/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]; } |
