From 67c0ceedc9833f2c495dfe78e4bc0d80a9b2fd18 Mon Sep 17 00:00:00 2001 From: camo0112 <56369484+camo0112@users.noreply.github.com> Date: Tue, 20 Apr 2021 13:06:40 +0530 Subject: [PATCH] Error handling in subscribe() in DownloadDialog --- .../newpipe/download/DownloadDialog.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java b/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java index 4d3726c38..6d9f727a1 100644 --- a/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java +++ b/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java @@ -312,25 +312,27 @@ public class DownloadDialog extends DialogFragment private void fetchStreamsSize() { disposables.clear(); - disposables.add(StreamSizeWrapper.fetchSizeForWrapper(wrappedVideoStreams) .subscribe(result -> { - if (dialogBinding.videoAudioGroup.getCheckedRadioButtonId() == R.id.video_button) { - setupVideoSpinner(); - } - })); + if (dialogBinding.videoAudioGroup.getCheckedRadioButtonId() + == R.id.video_button) { + setupVideoSpinner(); + } + }, throwable -> Log.e(TAG, "Throwable " + throwable.getMessage()))); disposables.add(StreamSizeWrapper.fetchSizeForWrapper(wrappedAudioStreams) .subscribe(result -> { - if (dialogBinding.videoAudioGroup.getCheckedRadioButtonId() == R.id.audio_button) { - setupAudioSpinner(); - } - })); + if (dialogBinding.videoAudioGroup.getCheckedRadioButtonId() + == R.id.audio_button) { + setupAudioSpinner(); + } + }, throwable -> Log.e(TAG, "Throwable " + throwable.getMessage()))); disposables.add(StreamSizeWrapper.fetchSizeForWrapper(wrappedSubtitleStreams) .subscribe(result -> { - if (dialogBinding.videoAudioGroup.getCheckedRadioButtonId() == R.id.subtitle_button) { - setupSubtitleSpinner(); - } - })); + if (dialogBinding.videoAudioGroup.getCheckedRadioButtonId() + == R.id.subtitle_button) { + setupSubtitleSpinner(); + } + }, throwable -> Log.e(TAG, "Throwable " + throwable.getMessage()))); } @Override