Add null check before using mCallback

There's some strange cases where onErrorInternal is being invoked
but mCallback is null. However, currently we only have a stack trace.
If this really is a problem, a bugreport will be needed. We can only
fix the NPE for now.

Fixes: 166187582
Test: Builds
Change-Id: I8ea932aadb15757383f273b0f6232b379c6b9ae1
This commit is contained in:
Kevin Chyn
2020-09-08 16:10:12 -07:00
parent 34639f4769
commit 1e27ae7084

View File

@@ -98,7 +98,11 @@ public abstract class AcquisitionClient<T> extends ClientMonitor<T> implements I
}
if (finish) {
mCallback.onClientFinished(this, false /* success */);
if (mCallback == null) {
Slog.e(TAG, "Callback is null, perhaps the client hasn't been started yet?");
} else {
mCallback.onClientFinished(this, false /* success */);
}
}
}