diff options
Diffstat (limited to 'libjava/classpath/javax/swing/InputMap.java')
-rw-r--r-- | libjava/classpath/javax/swing/InputMap.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libjava/classpath/javax/swing/InputMap.java b/libjava/classpath/javax/swing/InputMap.java index a7ec38c4117..cc65dfeed3e 100644 --- a/libjava/classpath/javax/swing/InputMap.java +++ b/libjava/classpath/javax/swing/InputMap.java @@ -171,8 +171,12 @@ public class InputMap */ public KeyStroke[] keys() { - KeyStroke[] array = new KeyStroke[size()]; - return (KeyStroke[]) inputMap.keySet().toArray(array); + if (size() != 0) + { + KeyStroke[] array = new KeyStroke[size()]; + return (KeyStroke[]) inputMap.keySet().toArray(array); + } + return null; } /** @@ -189,7 +193,9 @@ public class InputMap set.addAll(Arrays.asList(parent.allKeys())); set.addAll(inputMap.keySet()); - KeyStroke[] array = new KeyStroke[size()]; + if (set.size() == 0) + return null; + KeyStroke[] array = new KeyStroke[set.size()]; return (KeyStroke[]) set.toArray(array); } |