From 5ba31aa77d4319c3a473d626c5bd48be5c3a0dd2 Mon Sep 17 00:00:00 2001 From: Clara Bayarri Date: Fri, 23 Oct 2015 13:22:14 +0100 Subject: [PATCH] Fix crash in KeyboardView with null Handler A recent change in how the handler is created in KeyboardView caused the password change flow to crash in ChooseLockPassword. Change-Id: Id5fcb256f9a09b75bf91c5c79614d8abfc29747f --- core/java/android/inputmethodservice/KeyboardView.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/java/android/inputmethodservice/KeyboardView.java b/core/java/android/inputmethodservice/KeyboardView.java index dc2aa3a8bf3ab..d1000ade1ed0d 100644 --- a/core/java/android/inputmethodservice/KeyboardView.java +++ b/core/java/android/inputmethodservice/KeyboardView.java @@ -1410,9 +1410,11 @@ public class KeyboardView extends View implements View.OnClickListener { } private void removeMessages() { - mHandler.removeMessages(MSG_REPEAT); - mHandler.removeMessages(MSG_LONGPRESS); - mHandler.removeMessages(MSG_SHOW_PREVIEW); + if (mHandler != null) { + mHandler.removeMessages(MSG_REPEAT); + mHandler.removeMessages(MSG_LONGPRESS); + mHandler.removeMessages(MSG_SHOW_PREVIEW); + } } @Override