Fix NullPointerException on eventSink

This commit is contained in:
Ryan Heise 2020-04-05 02:06:56 +10:00
parent 8d15a6c65c
commit 7911f2010f
1 changed files with 3 additions and 1 deletions

View File

@ -228,8 +228,10 @@ public class AudioPlayer implements MethodCallHandler, Player.EventListener {
event.add(updatePosition = getCurrentPosition()); event.add(updatePosition = getCurrentPosition());
event.add(updateTime = System.currentTimeMillis()); event.add(updateTime = System.currentTimeMillis());
event.add(Math.max(updatePosition, bufferedPosition)); event.add(Math.max(updatePosition, bufferedPosition));
if (eventSink != null) {
eventSink.success(event); eventSink.success(event);
} }
}
private long getCurrentPosition() { private long getCurrentPosition() {
if (state == PlaybackState.none || state == PlaybackState.connecting) { if (state == PlaybackState.none || state == PlaybackState.connecting) {