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

Unified Diff: services/speech_recognizer/src/org/chromium/mojo/speech_recognizer/SpeechRecognizerServiceImpl.java

Issue 1839963003: Fix crash in speech_recognizer service (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebased Created 4 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/speech_recognizer/src/org/chromium/mojo/speech_recognizer/SpeechRecognizerServiceImpl.java
diff --git a/services/speech_recognizer/src/org/chromium/mojo/speech_recognizer/SpeechRecognizerServiceImpl.java b/services/speech_recognizer/src/org/chromium/mojo/speech_recognizer/SpeechRecognizerServiceImpl.java
index 7299f5c7ba3a4e4ed45cd0d5e224712afdfa0f50..745e8bfcc16d90670eef289cb4b21e60762a8f32 100644
--- a/services/speech_recognizer/src/org/chromium/mojo/speech_recognizer/SpeechRecognizerServiceImpl.java
+++ b/services/speech_recognizer/src/org/chromium/mojo/speech_recognizer/SpeechRecognizerServiceImpl.java
@@ -133,9 +133,11 @@ final class SpeechRecognizerServiceImpl implements SpeechRecognizerService {
// The enum in the mojom for SpeechRecognizerService matches the
// errors that come from Android's RecognizerService.
result_or_error.setErrorCode(error);
- mCallback.call(result_or_error);
- mCallback = null;
+ if (mCallback != null) {
+ mCallback.call(result_or_error);
+ mCallback = null;
+ }
}
@Override
public void onResults(Bundle results) {
@@ -158,8 +160,10 @@ final class SpeechRecognizerServiceImpl implements SpeechRecognizerService {
result_or_error.setResults(
candidates.toArray(new UtteranceCandidate[candidates.size()]));
- mCallback.call(result_or_error);
- mCallback = null;
+ if (mCallback != null) {
+ mCallback.call(result_or_error);
+ mCallback = null;
+ }
}
@Override
public void onPartialResults(Bundle partialResults) {}
« 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