Merge pull request #4438 from ByteHamster/description-crash-hotfix

Fixed crash (fromCallable rethrows instead of calling onError)
This commit is contained in:
H. Lehmann 2020-09-20 11:56:50 +02:00 committed by GitHub
commit 490ae5ec1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 11 deletions

View File

@ -11,6 +11,7 @@ import android.view.ViewGroup;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.util.playback.Playable;
import de.danoeh.antennapod.core.util.playback.PlaybackController;
import de.danoeh.antennapod.core.util.playback.Timeline;
import de.danoeh.antennapod.view.ShownotesWebView;
@ -82,8 +83,10 @@ public class ItemDescriptionFragment extends Fragment {
if (webViewLoader != null) {
webViewLoader.dispose();
}
webViewLoader = Maybe.fromCallable(this::loadData)
.subscribeOn(Schedulers.io())
webViewLoader = Maybe.<String>create(emitter -> {
Timeline timeline = new Timeline(getActivity(), controller.getMedia());
emitter.onSuccess(timeline.processShownotes());
}).subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(data -> {
webvDescription.loadDataWithBaseURL("https://127.0.0.1", data, "text/html",
@ -92,15 +95,6 @@ public class ItemDescriptionFragment extends Fragment {
}, error -> Log.e(TAG, Log.getStackTraceString(error)));
}
@Nullable
private String loadData() {
if (controller == null || controller.getMedia() == null) {
return null;
}
Timeline timeline = new Timeline(getActivity(), controller.getMedia());
return timeline.processShownotes();
}
@Override
public void onPause() {
super.onPause();