Browse Source

Prevent crash when returning empty (like a cancelled scan) from the barcode scanner. Fixes #209.

pull/222/merge
Eric Kok 10 years ago
parent
commit
cf631082d2
  1. 2
      app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java

2
app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java

@ -774,10 +774,12 @@ public class TorrentsActivity extends ActionBarActivity implements TorrentTasksE @@ -774,10 +774,12 @@ public class TorrentsActivity extends ActionBarActivity implements TorrentTasksE
@Background
@OnActivityResult(BarcodeHelper.ACTIVITY_BARCODE_ADDTORRENT)
public void onBarcodeScanned(int resultCode, Intent data) {
if (data != null) {
// We receive from the helper either a URL (as string) or a query we can start a search for
String query = BarcodeHelper.handleScanResult(resultCode, data, navigationHelper.enableSearchUi());
onBarcodeScanHandled(data.getStringExtra("SCAN_RESULT"), query);
}
}
@UiThread
protected void onBarcodeScanHandled(String barcode, String result) {

Loading…
Cancel
Save