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 443421024..221496598 100755 --- a/zxing-android-embedded/src/com/journeyapps/barcodescanner/camera/CameraManager.java +++ b/zxing-android-embedded/src/com/journeyapps/barcodescanner/camera/CameraManager.java @@ -96,12 +96,14 @@ public void onPreviewFrame(byte[] data, Camera camera) { Size cameraResolution = resolution; PreviewCallback callback = this.callback; if (cameraResolution != null && callback != null) { - int format = camera.getParameters().getPreviewFormat(); try { + int format = camera.getParameters().getPreviewFormat(); SourceData source = new SourceData(data, cameraResolution.width, cameraResolution.height, format, getCameraRotation()); callback.onPreview(source); - } catch (IllegalArgumentException e) { - // Image data does not match the resolution + } catch (RuntimeException e) { + // Could be: + // java.lang.RuntimeException: getParameters failed (empty parameters) + // IllegalArgumentException: Image data does not match the resolution Log.e(TAG, "Camera preview failed", e); callback.onPreviewError(e); }