Skip to content

Commit

Permalink
Fixed a NullPointerException when executing the voice.start() functio…
Browse files Browse the repository at this point in the history
…n with extra params on Android. (#435)
  • Loading branch information
goheroes authored Aug 1, 2023
1 parent 03da891 commit 444bdcd
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions android/src/main/java/com/wenkesj/voice/VoiceModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,10 @@ public void onPartialResults(Bundle results) {
WritableArray arr = Arguments.createArray();

ArrayList<String> matches = results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
for (String result : matches) {
arr.pushString(result);
if (matches != null) {
for (String result : matches) {
arr.pushString(result);
}
}

WritableMap event = Arguments.createMap();
Expand All @@ -345,10 +347,11 @@ public void onResults(Bundle results) {
WritableArray arr = Arguments.createArray();

ArrayList<String> matches = results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
for (String result : matches) {
arr.pushString(result);
if (matches != null) {
for (String result : matches) {
arr.pushString(result);
}
}

WritableMap event = Arguments.createMap();
event.putArray("value", arr);
sendEvent("onSpeechResults", event);
Expand Down

0 comments on commit 444bdcd

Please sign in to comment.