summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/camera/CaptureModule.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java
index e21fd3029..0ad6212df 100644
--- a/src/com/android/camera/CaptureModule.java
+++ b/src/com/android/camera/CaptureModule.java
@@ -1349,7 +1349,17 @@ public class CaptureModule extends BaseModule<CaptureUI> implements PhotoControl
CameraManager manager = (CameraManager) mActivity.getSystemService(Context.CAMERA_SERVICE);
try {
String[] cameraIdList = manager.getCameraIdList();
- for (int i = 0; i < cameraIdList.length; i++) {
+ int cameraIdListLength = cameraIdList.length;
+
+ if (cameraIdListLength > MAX_NUM_CAM)
+ Log.w(TAG, "Number of available cameras (" + cameraIdListLength + ") exceeds "
+ + "max supported cameras (" + MAX_NUM_CAM + ")");
+
+ for (int i = 0; i < cameraIdListLength; i++) {
+ if (i >= MAX_NUM_CAM) {
+ Log.w(TAG, "Skipping set up for camera with id " + i);
+ break;
+ }
String cameraId = cameraIdList[i];
CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId);