From f9bc75e714bac272798ca693c918917c455be641 Mon Sep 17 00:00:00 2001 From: Jimmy Sun Date: Sat, 15 Dec 2018 16:39:49 +0800 Subject: [PATCH] Fix a list removing bug in Camera2 --- .../main/api21/com/google/android/cameraview/Camera2.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/library/src/main/api21/com/google/android/cameraview/Camera2.java b/library/src/main/api21/com/google/android/cameraview/Camera2.java index 4835f89e..0440c749 100644 --- a/library/src/main/api21/com/google/android/cameraview/Camera2.java +++ b/library/src/main/api21/com/google/android/cameraview/Camera2.java @@ -426,9 +426,11 @@ private void collectCameraInfo() { } mPictureSizes.clear(); collectPictureSizes(mPictureSizes, map); - for (AspectRatio ratio : mPreviewSizes.ratios()) { + Iterator iterator = mPreviewSizes.ratios().iterator(); + while (iterator.hasNext()) { + AspectRatio ratio = iterator.next(); if (!mPictureSizes.ratios().contains(ratio)) { - mPreviewSizes.remove(ratio); + iterator.remove(); } }