Ensure that the context is non-null when loading the shownotes (#6327)

This commit is contained in:
ByteHamster 2023-02-18 13:08:47 +01:00 committed by GitHub
parent 5b6fe580e0
commit 4e1a3be122
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package de.danoeh.antennapod.fragment;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
@ -86,6 +87,10 @@ public class ItemDescriptionFragment extends Fragment {
if (webViewLoader != null) {
webViewLoader.dispose();
}
Context context = getContext();
if (context == null) {
return;
}
webViewLoader = Maybe.<String>create(emitter -> {
Playable media = controller.getMedia();
if (media == null) {
@ -100,7 +105,7 @@ public class ItemDescriptionFragment extends Fragment {
DBReader.loadDescriptionOfFeedItem(feedMedia.getItem());
}
ShownotesCleaner shownotesCleaner = new ShownotesCleaner(
getActivity(), media.getDescription(), media.getDuration());
context, media.getDescription(), media.getDuration());
emitter.onSuccess(shownotesCleaner.processShownotes());
})
.subscribeOn(Schedulers.io())