diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionsImportFragment.java b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionsImportFragment.java index 56972b60d99..510439b6752 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionsImportFragment.java +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/SubscriptionsImportFragment.java @@ -50,11 +50,11 @@ public class SubscriptionsImportFragment extends BaseFragment { @State int currentServiceId = Constants.NO_SERVICE_ID; - private List supportedSources; - private String relatedUrl; + private List supportedSources = Collections.emptyList(); + private String relatedUrl = null; @StringRes - private int instructionsString; + private int instructionsString = 0; /*////////////////////////////////////////////////////////////////////////// // Views @@ -85,7 +85,17 @@ private void setInitialData(final int serviceId) { public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setupServiceVariables(); + if (currentServiceId != Constants.NO_SERVICE_ID) { + try { + final SubscriptionExtractor extractor = NewPipe.getService(currentServiceId) + .getSubscriptionExtractor(); + supportedSources = extractor.getSupportedSources(); + relatedUrl = extractor.getRelatedUrl(); + instructionsString = ServiceHelper.getImportInstructions(currentServiceId); + } catch (final ExtractionException ignored) { + } + } + if (supportedSources.isEmpty() && currentServiceId != Constants.NO_SERVICE_ID) { ErrorUtil.showSnackbar(activity, new ErrorInfo(new String[]{}, UserAction.SUBSCRIPTION_IMPORT_EXPORT, @@ -203,23 +213,6 @@ private void requestImportFileResult(final ActivityResult result) { // Subscriptions /////////////////////////////////////////////////////////////////////////// - private void setupServiceVariables() { - if (currentServiceId != Constants.NO_SERVICE_ID) { - try { - final SubscriptionExtractor extractor = NewPipe.getService(currentServiceId) - .getSubscriptionExtractor(); - supportedSources = extractor.getSupportedSources(); - relatedUrl = extractor.getRelatedUrl(); - instructionsString = ServiceHelper.getImportInstructions(currentServiceId); - return; - } catch (final ExtractionException ignored) { - } - } - - supportedSources = Collections.emptyList(); - relatedUrl = null; - instructionsString = 0; - } private void setInfoText(final String infoString) { infoTextView.setText(infoString);