Credntia / MVBarcodeReader

A Barcode scanner library for Android. Uses the Google Play Services' mobile vision api for barcode detection.
Apache License 2.0
68 stars 22 forks source link

Crash when the device has no flash #4

Closed NitroG42 closed 7 years ago

NitroG42 commented 7 years ago

There is a crash when the user's device has no flash, in CameraSource.java line 567 parameters.getSupportedFlashModes() => returns null

iamMehedi commented 7 years ago

@NitroG42 can you please share the stacktrace.

NitroG42 commented 7 years ago
Fatal Exception: java.lang.NullPointerException
       at devliving.online.mvbarcodereader.camera.CameraSource.setFlashMode(CameraSource.java:567)
       at devliving.online.mvbarcodereader.BarcodeCaptureFragment$1.onClick(BarcodeCaptureFragment.java:129)
       at android.view.View.performClick(View.java:4651)
       at android.view.View$PerformClick.run(View.java:19310)
       at android.os.Handler.handleCallback(Handler.java:733)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:146)
       at android.app.ActivityThread.main(ActivityThread.java:5653)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:515)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
       at dalvik.system.NativeStart.main(NativeStart.java)

Devices with crash: Samsung GT-P5210 Samsung SM-T280 Samsung SM-T330NU Acer A3-A10

Mostly tablets I think

iamMehedi commented 7 years ago

bf8a964 should fix it.

godofrayer commented 6 years ago

Still has the same issue as this. Is the library not updated from the commit?

iamMehedi commented 6 years ago

Seems like the issue reappeared as this library now depends on the AndroidVisionPipeline library and this fix wasn't added to that. I have created an issue over there. https://github.com/Credntia/AndroidVisionPipeline/issues/1