Fixing NPE when cancelling a barcode scan.