Merge pull request #5010 from ByteHamster/crash-fix

Various crash fixes reported in the beta
This commit is contained in:
ByteHamster 2021-03-08 10:15:20 +01:00 committed by GitHub
commit a49b4477a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 11 deletions

View File

@ -137,13 +137,6 @@
</intent-filter>
</activity>
<service
android:name=".core.service.PlayerWidgetJobService"
android:permission="android.permission.BIND_JOB_SERVICE"
android:enabled="true"
android:exported="false">
</service>
<receiver
android:name=".core.receiver.PlayerWidget"
android:exported="true">

View File

@ -53,6 +53,10 @@ public class ChaptersListAdapter extends RecyclerView.Adapter<ChaptersListAdapte
@Override
public void onBindViewHolder(@NonNull ChapterHolder holder, int position) {
Chapter sc = getItem(position);
if (sc == null) {
holder.title.setText("Error");
return;
}
holder.title.setText(sc.getTitle());
holder.start.setText(Converter.getDurationStringLong((int) sc
.getStart()));

View File

@ -105,7 +105,9 @@ public class ExoPlayerWrapper implements IPlayer {
@Override
public void onSeekProcessed() {
audioSeekCompleteListener.onSeekComplete(null);
if (audioSeekCompleteListener != null) {
audioSeekCompleteListener.onSeekComplete(null);
}
}
});
}
@ -174,7 +176,9 @@ public class ExoPlayerWrapper implements IPlayer {
@Override
public void seekTo(int i) throws IllegalStateException {
exoPlayer.seekTo(i);
audioSeekCompleteListener.onSeekComplete(null);
if (audioSeekCompleteListener != null) {
audioSeekCompleteListener.onSeekComplete(null);
}
}
@Override

View File

@ -208,7 +208,9 @@ public abstract class PlaybackController {
handleStatus();
} else {
Log.w(TAG, "Couldn't receive status update: playbackService was null");
bindToService();
if (PlaybackService.isRunning) {
bindToService();
}
}
}
};
@ -232,7 +234,7 @@ public abstract class PlaybackController {
onBufferUpdate(progress);
break;
case PlaybackService.NOTIFICATION_TYPE_RELOAD:
if (playbackService == null) {
if (playbackService == null && PlaybackService.isRunning) {
bindToService();
return;
}