mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 12:49:55 +01:00
Catch RuntimeException when getting camera parameters
This commit is contained in:
@@ -22,6 +22,7 @@ import org.briarproject.bramble.api.nullsafety.ParametersNotNullByDefault;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import static java.util.logging.Level.INFO;
|
import static java.util.logging.Level.INFO;
|
||||||
|
import static java.util.logging.Level.WARNING;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@MethodsNotNullByDefault
|
@MethodsNotNullByDefault
|
||||||
@@ -60,8 +61,12 @@ class QrCodeDecoder implements PreviewConsumer, PreviewCallback {
|
|||||||
@Override
|
@Override
|
||||||
public void onPreviewFrame(byte[] data, Camera camera) {
|
public void onPreviewFrame(byte[] data, Camera camera) {
|
||||||
if (camera == this.camera) {
|
if (camera == this.camera) {
|
||||||
Size size = camera.getParameters().getPreviewSize();
|
try {
|
||||||
new DecoderTask(data, size.width, size.height).execute();
|
Size size = camera.getParameters().getPreviewSize();
|
||||||
|
new DecoderTask(data, size.width, size.height).execute();
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
LOG.log(WARNING, "Error getting camera parameters.", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,7 +75,7 @@ class QrCodeDecoder implements PreviewConsumer, PreviewCallback {
|
|||||||
private final byte[] data;
|
private final byte[] data;
|
||||||
private final int width, height;
|
private final int width, height;
|
||||||
|
|
||||||
DecoderTask(byte[] data, int width, int height) {
|
private DecoderTask(byte[] data, int width, int height) {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
this.width = width;
|
this.width = width;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
|
|||||||
Reference in New Issue
Block a user