From 47e9db8fdff9c538698450725cc0a369e6e9eab5 Mon Sep 17 00:00:00 2001 From: dhewg Date: Thu, 17 Mar 2011 22:02:17 +0100 Subject: ANDROID: Fix KeyEvent NullPointerException Could happen with some special symbols from the virtual keyboard --- .../platform/android/org/inodes/gus/scummvm/ScummVMEvents.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'backends') 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()); -- cgit v1.2.3