From 8040052ff22b2b9ef53a93c95c7ae57d6153099e Mon Sep 17 00:00:00 2001 From: Eric Kok Date: Thu, 21 Nov 2013 11:01:35 +0100 Subject: [PATCH] Prevent malformed torrent/magnet/file links (to add via start intent) to crash Transdroid. --- core/src/org/transdroid/core/gui/TorrentsActivity.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/org/transdroid/core/gui/TorrentsActivity.java b/core/src/org/transdroid/core/gui/TorrentsActivity.java index 2ece4bd4..77ccdb8b 100644 --- a/core/src/org/transdroid/core/gui/TorrentsActivity.java +++ b/core/src/org/transdroid/core/gui/TorrentsActivity.java @@ -497,9 +497,13 @@ public class TorrentsActivity extends SherlockFragmentActivity implements OnNavi // Add a torrent from a local or remote data URI? if (dataUri == null) return; + if (dataUri.getScheme() == null) { + Crouton.showText(this, R.string.error_invalid_url_form, NavigationHelper.CROUTON_ERROR_STYLE); + return; + } // Adding a torrent from the Android downloads manager - if (dataUri.getScheme() != null && dataUri.getScheme().equals(ContentResolver.SCHEME_CONTENT)) { + if (dataUri.getScheme().equals(ContentResolver.SCHEME_CONTENT)) { addTorrentFromDownloads(dataUri); return; }