From c2734ecb7e8d1aa09546cdbb2c2d62fa35709cb2 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Fri, 20 Mar 2020 14:12:01 +0100 Subject: [PATCH] Fixed adding feeds when clipboard is empty --- .../java/de/danoeh/antennapod/fragment/AddFeedFragment.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java index 8f6f4d964..2d2244a85 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/AddFeedFragment.java @@ -76,9 +76,9 @@ public class AddFeedFragment extends Fragment { EditText editText = content.findViewById(R.id.text); editText.setHint(R.string.add_podcast_by_url_hint); ClipboardManager clipboard = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE); - String clipboardContent = clipboard.getText().toString(); - if (clipboardContent.startsWith("http")) { - editText.setText(clipboardContent); + String clipboardContent = clipboard.getText() != null ? clipboard.getText().toString() : ""; + if (clipboardContent.trim().startsWith("http")) { + editText.setText(clipboardContent.trim()); } builder.setView(content); builder.setPositiveButton(R.string.confirm_label, (dialog, which) -> addUrl(editText.getText().toString()));