From acce1aa59eac6816fe3ce1fcb014666fc71a40f1 Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Wed, 27 Aug 2014 12:37:22 -0700 Subject: [PATCH] Make sure to obtain the IC before requesting CursorAnchorInfo RichInputConnection#requestUpdateCursorAnchorInfo must make sure to obtain the input connection before calling methods of it. BUG: 17299587 Change-Id: I8e0cd473a4cc32583cd47634c227d702f7c69c6c --- .../android/inputmethod/latin/RichInputConnection.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java index 497823aeb..f1c7f4340 100644 --- a/java/src/com/android/inputmethod/latin/RichInputConnection.java +++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java @@ -924,8 +924,14 @@ public final class RichInputConnection { */ public boolean requestUpdateCursorAnchorInfo(final boolean enableMonitor, final boolean requestImmediateCallback) { - final boolean scheduled = InputConnectionCompatUtils.requestUpdateCursorAnchorInfo(mIC, - enableMonitor, requestImmediateCallback); + mIC = mParent.getCurrentInputConnection(); + final boolean scheduled; + if (null != mIC) { + scheduled = InputConnectionCompatUtils.requestUpdateCursorAnchorInfo(mIC, + enableMonitor, requestImmediateCallback); + } else { + scheduled = false; + } mCursorAnchorInfoMonitorEnabled = (scheduled && enableMonitor); return scheduled; }