aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordhewg2011-03-17 22:02:17 +0100
committerdhewg2011-03-17 22:02:17 +0100
commit47e9db8fdff9c538698450725cc0a369e6e9eab5 (patch)
treedb7f4f359a1017eabb5fbac18250574477e0635a
parent8ab136dafb2cef66e48ae24db6bd994e134f91e3 (diff)
downloadscummvm-rg350-47e9db8fdff9c538698450725cc0a369e6e9eab5.tar.gz
scummvm-rg350-47e9db8fdff9c538698450725cc0a369e6e9eab5.tar.bz2
scummvm-rg350-47e9db8fdff9c538698450725cc0a369e6e9eab5.zip
ANDROID: Fix KeyEvent NullPointerException
Could happen with some special symbols from the virtual keyboard
-rw-r--r--backends/platform/android/org/inodes/gus/scummvm/ScummVMEvents.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/backends/platform/android/org/inodes/gus/scummvm/ScummVMEvents.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVMEvents.java
index 7507d7e5fc..da589a326e 100644
--- a/backends/platform/android/org/inodes/gus/scummvm/ScummVMEvents.java
+++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVMEvents.java
@@ -119,9 +119,13 @@ public class ScummVMEvents implements
// sequence of characters
if (action == KeyEvent.ACTION_MULTIPLE &&
keyCode == KeyEvent.KEYCODE_UNKNOWN) {
- KeyCharacterMap m = KeyCharacterMap.load(e.getDeviceId());
+ final KeyCharacterMap m = KeyCharacterMap.load(e.getDeviceId());
+ final KeyEvent[] es = m.getEvents(e.getCharacters().toCharArray());
- for (KeyEvent s : m.getEvents(e.getCharacters().toCharArray())) {
+ if (es == null)
+ return true;
+
+ for (KeyEvent s : es) {
_scummvm.pushEvent(JE_KEY, s.getAction(), s.getKeyCode(),
s.getUnicodeChar() & KeyCharacterMap.COMBINING_ACCENT_MASK,
s.getMetaState(), s.getRepeatCount());