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> </intent-filter>
</activity> </activity>
<service
android:name=".core.service.PlayerWidgetJobService"
android:permission="android.permission.BIND_JOB_SERVICE"
android:enabled="true"
android:exported="false">
</service>
<receiver <receiver
android:name=".core.receiver.PlayerWidget" android:name=".core.receiver.PlayerWidget"
android:exported="true"> android:exported="true">

View File

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

View File

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

View File

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