Fixed adding feeds when clipboard is empty

This commit is contained in:
ByteHamster 2020-03-20 14:12:01 +01:00
parent d7cfa07c44
commit c2734ecb7e
1 changed files with 3 additions and 3 deletions

View File

@ -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()));