From 7a58c8afbf22049a008dc6850ed68f78d6336c9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 4 Jul 2020 23:21:05 +0200 Subject: [PATCH] Add a try/catch to Android camera device listing. Might help #13091 and the issue seen in #13057. --- android/src/org/ppsspp/ppsspp/CameraHelper.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/android/src/org/ppsspp/ppsspp/CameraHelper.java b/android/src/org/ppsspp/ppsspp/CameraHelper.java index 2b46fe8393ef..290a1b0027b9 100644 --- a/android/src/org/ppsspp/ppsspp/CameraHelper.java +++ b/android/src/org/ppsspp/ppsspp/CameraHelper.java @@ -140,10 +140,14 @@ static ArrayList getDeviceList() { ArrayList deviceList = new ArrayList<>(); int nrCam = Camera.getNumberOfCameras(); for (int index = 0; index < nrCam; index++) { - Camera.CameraInfo info = new Camera.CameraInfo(); - Camera.getCameraInfo(index, info); - String devName = index + ":" + (info.facing == Camera.CameraInfo.CAMERA_FACING_BACK ? "Back Camera" : "Front Camera"); - deviceList.add(devName); + try { + Camera.CameraInfo info = new Camera.CameraInfo(); + Camera.getCameraInfo(index, info); + String devName = index + ":" + (info.facing == Camera.CameraInfo.CAMERA_FACING_BACK ? "Back Camera" : "Front Camera"); + deviceList.add(devName); + } catch (Exception e) { + Log.e(TAG, "Failed to get camera info: " + e.toString()); + } } return deviceList; }