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. 8
      app/src/main/java/org/transdroid/core/gui/TorrentsActivity.java

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

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

Loading…
Cancel
Save