diff --git a/zxing-android-embedded/src/com/journeyapps/barcodescanner/camera/CameraManager.java b/zxing-android-embedded/src/com/journeyapps/barcodescanner/camera/CameraManager.java index 221496598..310278eeb 100755 --- a/zxing-android-embedded/src/com/journeyapps/barcodescanner/camera/CameraManager.java +++ b/zxing-android-embedded/src/com/journeyapps/barcodescanner/camera/CameraManager.java @@ -97,6 +97,9 @@ public void onPreviewFrame(byte[] data, Camera camera) { PreviewCallback callback = this.callback; if (cameraResolution != null && callback != null) { try { + if(data == null) { + throw new NullPointerException("No preview data received"); + } int format = camera.getParameters().getPreviewFormat(); SourceData source = new SourceData(data, cameraResolution.width, cameraResolution.height, format, getCameraRotation()); callback.onPreview(source);