Skip to content

Commit

Permalink
Fix NPE when listener is not set
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 488970696
  • Loading branch information
Googler authored and microkatz committed Nov 22, 2022
1 parent bae5090 commit f3ed9e3
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -900,9 +900,11 @@ public boolean handleBuffer(
getSubmittedFrames() - trimmingAudioProcessor.getTrimmedFrameCount());
if (!startMediaTimeUsNeedsSync
&& Math.abs(expectedPresentationTimeUs - presentationTimeUs) > 200000) {
listener.onAudioSinkError(
new AudioSink.UnexpectedDiscontinuityException(
presentationTimeUs, expectedPresentationTimeUs));
if (listener != null) {
listener.onAudioSinkError(
new AudioSink.UnexpectedDiscontinuityException(
presentationTimeUs, expectedPresentationTimeUs));
}
startMediaTimeUsNeedsSync = true;
}
if (startMediaTimeUsNeedsSync) {
Expand Down

0 comments on commit f3ed9e3

Please sign in to comment.