Check for null callback
The modelData callback may be nullified before actually being invoked,
e.g. when calling startRecognition() on an already running model, with
a different callback.
Fixes: 225768984
Test: Manual reproduction on the issue and then applying the fix and
verifying that it works.
Change-Id: I089061123c8cf12eef19fdf16bb3a2c106ea2438
This commit is contained in:
@@ -923,7 +923,10 @@ public class SoundTriggerHelper implements SoundTrigger.StatusListener {
|
||||
if (modelData != null && modelData.isModelStarted()) {
|
||||
modelData.setStoppedLocked();
|
||||
try {
|
||||
modelData.getCallback().onRecognitionPaused();
|
||||
IRecognitionStatusCallback callback = modelData.getCallback();
|
||||
if (callback != null) {
|
||||
callback.onRecognitionPaused();
|
||||
}
|
||||
} catch (DeadObjectException e) {
|
||||
forceStopAndUnloadModelLocked(modelData, e);
|
||||
} catch (RemoteException e) {
|
||||
|
||||
Reference in New Issue
Block a user