Browse Source

Prevent crash when returning from adding by barcode without having scanned anything.

pull/222/merge
Eric Kok 10 years ago
parent
commit
14c726c1c3
  1. 4
      app/src/main/java/org/transdroid/core/gui/search/BarcodeHelper.java

4
app/src/main/java/org/transdroid/core/gui/search/BarcodeHelper.java

@ -106,8 +106,8 @@ public class BarcodeHelper { @@ -106,8 +106,8 @@ public class BarcodeHelper {
* can be constructed for it
*/
public static String handleScanResult(int resultCode, Intent data, boolean supportsSearch) {
String contents = data.getStringExtra("SCAN_RESULT");
String formatName = data.getStringExtra("SCAN_RESULT_FORMAT");
String contents = data != null? data.getStringExtra("SCAN_RESULT"): null;
String formatName = data != null? data.getStringExtra("SCAN_RESULT_FORMAT"): null;
if (formatName != null && formatName.equals("QR_CODE")) {
// Scanned barcode was a QR code: return the contents directly
return contents;

Loading…
Cancel
Save