Browse Source

Prevent malformed torrent/magnet/file links (to add via start intent) to crash Transdroid.

pull/82/head
Eric Kok 11 years ago
parent
commit
8040052ff2
  1. 6
      core/src/org/transdroid/core/gui/TorrentsActivity.java

6
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? // Add a torrent from a local or remote data URI?
if (dataUri == null) if (dataUri == null)
return; 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 // 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); addTorrentFromDownloads(dataUri);
return; return;
} }

Loading…
Cancel
Save