Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Fix acquireLatestImage exceeds maxImage and cause IllegalStateException. #20475

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,13 @@ public boolean acquireLatestImage() {
//
// To avoid exceptions, check if a new image can be acquired.
if (pendingImages < imageReader.getMaxImages()) {
nextImage = imageReader.acquireLatestImage();
if (nextImage != null) {
pendingImages++;
try {
nextImage = imageReader.acquireLatestImage();
if (nextImage != null) {
pendingImages++;
}
} catch (IllegalStateException exception) {
// just bypass
}
}
invalidate();
Expand Down