Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2426)

Unified Diff: chrome/browser/spellchecker/spellchecker_session_bridge_android.cc

Issue 1310093007: Add a check for null returns from SpellChekerSessonBridge#create(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/spellchecker/spellchecker_session_bridge_android.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/spellchecker/spellchecker_session_bridge_android.cc
diff --git a/chrome/browser/spellchecker/spellchecker_session_bridge_android.cc b/chrome/browser/spellchecker/spellchecker_session_bridge_android.cc
index b879fd46b0f509b9ff61d603a6649dfcc8759b08..cf02f8c9b917f00cd5363b36f4c86bb0f88ec482 100644
--- a/chrome/browser/spellchecker/spellchecker_session_bridge_android.cc
+++ b/chrome/browser/spellchecker/spellchecker_session_bridge_android.cc
@@ -24,6 +24,11 @@ bool SpellCheckerSessionBridge::RegisterJNI(JNIEnv* env) {
void SpellCheckerSessionBridge::RequestTextCheck(int route_id,
int identifier,
const base::string16& text) {
+ // SpellCheckerSessionBridge#create() will return null if spell checker
+ // service is unavailable.
+ if (java_object_initialization_failed_)
+ return;
+
// RequestTextCheck IPC arrives at the message filter before
// ToggleSpellCheck IPC when the user focuses an input field that already
// contains completed text. We need to initialize the spellchecker here
@@ -33,6 +38,10 @@ void SpellCheckerSessionBridge::RequestTextCheck(int route_id,
java_object_.Reset(Java_SpellCheckerSessionBridge_create(
base::android::AttachCurrentThread(),
reinterpret_cast<intptr_t>(this)));
+ if (java_object_.is_null()) {
+ java_object_initialization_failed_ = true;
+ return;
+ }
}
// Save incoming requests to run at the end of the currently active request.
« no previous file with comments | « chrome/browser/spellchecker/spellchecker_session_bridge_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698