rb-forms-barcode
rb-forms-barcode copied to clipboard
NPE App crashes when going back from ScannerPage to the parentPage
The App crashes when the ScanPage is in the OnDissapearing method and is setting the IsEnabled=false variable on slower devices.
The following exception was thrown:
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.hardware.Camera.addCallbackBuffer(byte[])' on a null object
So the issue is in the following class on line 814: https://github.com/rebuy-de/rb-forms-barcode/blob/master/RebuyCameraSource/RebuyCameraSource/src/main/java/com/rebuy/play/services/vision/CameraSource.java
Can you please fix this and deploy a new version on nuget.
The fix could look like:
// The code below needs to run outside of synchronization, because this will allow
// the camera to add pending frame(s) while we are running detection on the current
// frame.
try {
mDetector.receiveFrame(outputFrame);
} catch (Throwable t) {
Log.e(TAG, "Exception thrown from receiver.", t);
} finally {
if(mCamera != null && data != null && data.array != null) {
mCamera.addCallbackBuffer(data.array());
}
}
Thanks in advance!
Best regards