From 14c726c1c3487cae1f86a97db4368f908b3b9bce Mon Sep 17 00:00:00 2001 From: Eric Kok Date: Wed, 19 Nov 2014 16:42:03 +0100 Subject: [PATCH] Prevent crash when returning from adding by barcode without having scanned anything. --- .../java/org/transdroid/core/gui/search/BarcodeHelper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/transdroid/core/gui/search/BarcodeHelper.java b/app/src/main/java/org/transdroid/core/gui/search/BarcodeHelper.java index 5a9124b5..7aaf6298 100644 --- a/app/src/main/java/org/transdroid/core/gui/search/BarcodeHelper.java +++ b/app/src/main/java/org/transdroid/core/gui/search/BarcodeHelper.java @@ -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;