OSDN Git Service

Potential fix for NPE at startExtractingText.
authorAmith Yamasani <yamasani@google.com>
Thu, 20 Aug 2009 01:27:56 +0000 (18:27 -0700)
committerAmith Yamasani <yamasani@google.com>
Thu, 20 Aug 2009 01:29:45 +0000 (18:29 -0700)
This is not easy to reproduce. Adding a simple null check to see if the
monkeys continue to hit the NPE.

core/java/android/inputmethodservice/InputMethodService.java

index 6ee92ce..1f640ea 100644 (file)
@@ -1992,8 +1992,9 @@ public class InputMethodService extends AbstractInputMethodService {
             req.flags = InputConnection.GET_TEXT_WITH_STYLES;
             req.hintMaxLines = 10;
             req.hintMaxChars = 10000;
-            mExtractedText = getCurrentInputConnection().getExtractedText(req,
-                    InputConnection.GET_EXTRACTED_TEXT_MONITOR);
+            InputConnection ic = getCurrentInputConnection();
+            mExtractedText = ic == null? null
+                    : ic.getExtractedText(req, InputConnection.GET_EXTRACTED_TEXT_MONITOR);
             
             final EditorInfo ei = getCurrentInputEditorInfo();