From f8a45cfd2fe3ed68d0e9ccbbed5d0beb2d1e9f06 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 27 Feb 2014 14:14:52 +0900 Subject: [PATCH] Fix NPE in KeyDetector This is actually a follow up of I9290974821. Bug: 13215075 Change-Id: Ib7eef55fd1cfbb05d06aeeb0726bc10c87b07d85 --- java/src/com/android/inputmethod/keyboard/KeyDetector.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/java/src/com/android/inputmethod/keyboard/KeyDetector.java b/java/src/com/android/inputmethod/keyboard/KeyDetector.java index 03d9defa0..87368d4ef 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyDetector.java +++ b/java/src/com/android/inputmethod/keyboard/KeyDetector.java @@ -86,6 +86,9 @@ public class KeyDetector { * @return the key that the touch point hits. */ public Key detectHitKey(final int x, final int y) { + if (mKeyboard == null) { + return null; + } final int touchX = getTouchX(x); final int touchY = getTouchY(y);