Merge pull request #3285 from ByteHamster/fix1

Fixed some crashes
This commit is contained in:
H. Lehmann 2019-07-23 21:56:24 +02:00 committed by GitHub
commit 8b77782348
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 5 deletions

View File

@ -169,6 +169,7 @@ public abstract class MediaplayerInfoActivity extends MediaplayerActivity implem
pager.setCurrentItem(lastPosition);
}
@Override
protected void onStart() {
super.onStart();
EventDistributor.getInstance().register(contentUpdate);

View File

@ -603,8 +603,9 @@ public class ItemFragment extends Fragment implements OnSwipeGesture {
@Nullable
private FeedItem loadInBackground() {
FeedItem feedItem = DBReader.getFeedItem(feedItems[feedItemPos]);
if (feedItem != null) {
Timeline t = new Timeline(getContext(), feedItem);
Context context = getContext();
if (feedItem != null && context != null) {
Timeline t = new Timeline(context, feedItem);
webviewData = t.processShownotes(false);
}
return feedItem;

View File

@ -41,6 +41,7 @@ public class PlayerWidgetJobService extends SafeJobIntentService {
private PlaybackService playbackService;
private final Object waitForService = new Object();
private final Object waitUsingService = new Object();
private static final int JOB_ID = -17001;
@ -67,7 +68,11 @@ public class PlayerWidgetJobService extends SafeJobIntentService {
}
}
synchronized (waitUsingService) {
if (playbackService != null) {
updateViews();
}
}
if (playbackService != null) {
try {
@ -230,7 +235,9 @@ public class PlayerWidgetJobService extends SafeJobIntentService {
@Override
public void onServiceDisconnected(ComponentName name) {
synchronized (waitUsingService) {
playbackService = null;
}
Log.d(TAG, "Disconnected from service");
}

View File

@ -243,7 +243,7 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer {
callback.onMediaChanged(false);
if (stream) {
mediaPlayer.setDataSource(media.getStreamUrl());
} else if (new File(media.getLocalMediaUrl()).canRead()) {
} else if (media.getLocalMediaUrl() != null && new File(media.getLocalMediaUrl()).canRead()) {
mediaPlayer.setDataSource(media.getLocalMediaUrl());
} else {
throw new IOException("Unable to read local file " + media.getLocalMediaUrl());