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 {
* can be constructed for it * can be constructed for it
*/ */
public static String handleScanResult(int resultCode, Intent data, boolean supportsSearch) { public static String handleScanResult(int resultCode, Intent data, boolean supportsSearch) {
String contents = data.getStringExtra("SCAN_RESULT"); String contents = data != null? data.getStringExtra("SCAN_RESULT"): null;
String formatName = data.getStringExtra("SCAN_RESULT_FORMAT"); String formatName = data != null? data.getStringExtra("SCAN_RESULT_FORMAT"): null;
if (formatName != null && formatName.equals("QR_CODE")) { if (formatName != null && formatName.equals("QR_CODE")) {
// Scanned barcode was a QR code: return the contents directly // Scanned barcode was a QR code: return the contents directly
return contents; return contents;

Loading…
Cancel
Save