From b1b3a9c7d0ba2069a3b62d04cbb81898f1fbb8a7 Mon Sep 17 00:00:00 2001 From: Ruslan Kyba Date: Thu, 22 Feb 2018 16:42:02 +0200 Subject: [PATCH] [core] Fixed data error --- lib/index.js | 2 +- package.json | 2 +- src/index.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/index.js b/lib/index.js index 7d0c0e9..049630f 100644 --- a/lib/index.js +++ b/lib/index.js @@ -275,7 +275,7 @@ module.exports = (_temp = _class = function (_Component) { var decoded = e.data; - onScan(decoded.data || null); + onScan(decoded && decoded.data || null); if (!legacyMode && typeof delay == 'number' && this.worker) { this.timeout = setTimeout(this.check, delay); diff --git a/package.json b/package.json index 193d446..2c4afae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-qr-scanner", - "version": "0.0.4", + "version": "0.0.5", "description": "A react component for reading QR codes from the webcam.", "main": "./lib/index.js", "scripts": { diff --git a/src/index.js b/src/index.js index 1fb367f..da11358 100644 --- a/src/index.js +++ b/src/index.js @@ -220,7 +220,7 @@ module.exports = class Reader extends Component { const { onScan, legacyMode, delay } = this.props const decoded = e.data - onScan(decoded.data || null) + onScan((decoded && decoded.data) || null) if (!legacyMode && typeof delay == 'number' && this.worker) { this.timeout = setTimeout(this.check, delay)