From ee41e3e43690cb9e0e8f0082157d95bd0e944938 Mon Sep 17 00:00:00 2001 From: EddyVerbruggen Date: Wed, 26 Feb 2020 11:32:40 +0100 Subject: [PATCH] Make sure the scanner object is available when calling 'stop' #235 --- demo/app/package.json | 3 ++- src/barcodescanner.ios.ts | 4 +++- src/package.json | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/demo/app/package.json b/demo/app/package.json index 31c9e0d..df14883 100644 --- a/demo/app/package.json +++ b/demo/app/package.json @@ -26,7 +26,8 @@ }, "homepage": "https://github.com/NativeScript/template-hello-world-ts", "android": { - "v8Flags": "--expose_gc" + "v8Flags": "--expose_gc", + "markingMode": "none" }, "devDependencies": { "nativescript-dev-typescript": "^0.3.0" diff --git a/src/barcodescanner.ios.ts b/src/barcodescanner.ios.ts index f3b8ca3..fe3d829 100644 --- a/src/barcodescanner.ios.ts +++ b/src/barcodescanner.ios.ts @@ -208,7 +208,9 @@ export class BarcodeScanner { try { this.close(); this._removeVolumeObserver(); - this._scanner.stopScanning(); + if (this._scanner) { + this._scanner.stopScanning(); + } this._closeCallback && this._closeCallback(); resolve(); } catch (ex) { diff --git a/src/package.json b/src/package.json index ebc7570..8564e24 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { "name": "nativescript-barcodescanner", - "version": "3.4.1", + "version": "3.4.2", "description": "Scan QR/barcodes with your NativeScript app.", "main": "barcodescanner", "typings": "index.d.ts",