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

Unified Diff: components/spellcheck/browser/android/java/src/org/chromium/components/spellcheck/SpellCheckerSessionBridge.java

Issue 2539583003: [Android] Fix NullPointerException crash in SpellCheckerSessionBridge. (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/spellcheck/browser/android/java/src/org/chromium/components/spellcheck/SpellCheckerSessionBridge.java
diff --git a/components/spellcheck/browser/android/java/src/org/chromium/components/spellcheck/SpellCheckerSessionBridge.java b/components/spellcheck/browser/android/java/src/org/chromium/components/spellcheck/SpellCheckerSessionBridge.java
index 679b2111f960c79d6b14c0b2ee4bdf498015c93c..0804e1469b36a538356a0e28d92d93875eddc61e 100644
--- a/components/spellcheck/browser/android/java/src/org/chromium/components/spellcheck/SpellCheckerSessionBridge.java
+++ b/components/spellcheck/browser/android/java/src/org/chromium/components/spellcheck/SpellCheckerSessionBridge.java
@@ -100,6 +100,12 @@ public class SpellCheckerSessionBridge implements SpellCheckerSessionListener {
ArrayList<Integer> lengths = new ArrayList<Integer>();
for (SentenceSuggestionsInfo result : results) {
+ if (result == null) {
+ // In some cases null can be returned by the selected spellchecking service,
+ // see crbug.com/651458. In this case skip to next result to avoid a
+ // NullPointerException later on.
+ continue;
+ }
for (int i = 0; i < result.getSuggestionsCount(); i++) {
// If a word looks like a typo, record its offset and length.
if ((result.getSuggestionsInfoAt(i).getSuggestionsAttributes()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698