tidev / ti.barcode

QR and Barcode Scanner
Other
66 stars 90 forks source link

Barcode.allowInstructions=false crashes the app after the second scan attempt (android) #13

Closed antongorodezkiy closed 6 years ago

antongorodezkiy commented 9 years ago

Hello friends,

First of all thank you for the library, it's very useful. And I was happy with it until I tried to set Barcode.allowInstructions = false;. First time it works great, instructions are not showing and the scanner works as expected. But after second scan attempt the app crashes with the following error.

Here is the stack trace (android):

[WARN] :   W/System.err: java.lang.NullPointerException
[WARN] :   W/System.err:    at ti.barcode.BarcodeModule.disableInstructions(BarcodeModule.java:317)
[WARN] :   W/System.err:    at ti.barcode.BarcodeModule.capture(BarcodeModule.java:297)
[WARN] :   W/System.err:    at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)
[WARN] :   W/System.err:    at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62)
[WARN] :   W/System.err:    at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:884)
[WARN] :   W/System.err:    at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1107)
[WARN] :   W/System.err:    at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:347)
[WARN] :   W/System.err:    at android.os.Handler.dispatchMessage(Handler.java:98)
[WARN] :   W/System.err:    at android.os.Looper.loop(Looper.java:136)
[WARN] :   W/System.err:    at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112)
[ERROR] :  TiExceptionHandler: (main) [114,14624] ----- Titanium Javascript Runtime Error -----
[ERROR] :  TiExceptionHandler: (main) [1,14625] - In alloy/controllers/input/input.js:1,69
[ERROR] :  TiExceptionHandler: (main) [1,14626] - Message: Uncaught Error: Java Exception occurred
[ERROR] :  TiExceptionHandler: (main) [1,14627] - Source: lert("addEvList cancelButton"),t.add(i),alert("cancelButton add"),a.capture({a
[ERROR] :  V8Exception: Exception occurred at alloy/controllers/input/input.js:1: Uncaught Error: Java Exception occurred

Environment: OS Ubuntu 14.04 Titanium Studio, build: 3.4.1.201410281727 Titanium SDK 3.5.0.GA Ti.barcode 2.3.5 Tested on devices LG-D690 (android 4.4.2) and Samsung GT-S7562 (android 4.0.4).

Thank you in advance

Widiyanto commented 7 years ago

you must triying comment properties of barcode. Example : var Barcode = require('ti.barcode'); /Barcode.allowRotation = true; Barcode.allowMenu = false; Barcode.allowInstructions = false;/ Barcode.capture({ animate: true, //overlay: overlay, /showCancel: true, showRectangle: false, keepOpen: false/ });

that's work well

hansemannn commented 6 years ago

Fixed in recent versions of the module. Closing.