summaryrefslogtreecommitdiff
path: root/src/android/camera_device.cpp
diff options
context:
space:
mode:
authorHirokazu Honda <hiroh@chromium.org>2020-10-28 17:57:26 +0900
committerKieran Bingham <kieran.bingham@ideasonboard.com>2020-10-28 15:52:51 +0000
commit3a777d8cc10bf664c301cf53703f50d71f12b052 (patch)
tree22e35f89b623982542347b96bc332795cf1ee34b /src/android/camera_device.cpp
parentbfd588d1d8332453b5f7afc6749fc6f3bf00c0bd (diff)
android: camera_device: Fix crash of accessing a missing map element
std::map::at() searches std::map by the given key. The commit e1f9fdb8a5bd ("android: camera_device: Remove shadowing FrameBuffer usage") uses it with 0 to intend to accessing the first element of the map, but actually access the element whose key is nullptr. This causes the crash because the map doesn't have the element with nullptr. This fixes the issue by replacing the std::map::at() operation by std::map::begin(). Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> [Kieran: Updated commit message] Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/android/camera_device.cpp')
-rw-r--r--src/android/camera_device.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index ca60f513..ead8a433 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -1525,7 +1525,7 @@ void CameraDevice::requestComplete(Request *request)
* It might be appropriate to return a 'correct' (as determined by
* pipeline handlers) timestamp in the Request itself.
*/
- uint64_t timestamp = buffers.at(0)->metadata().timestamp;
+ uint64_t timestamp = buffers.begin()->second->metadata().timestamp;
resultMetadata = getResultMetadata(descriptor->frameNumber_, timestamp);
/* Handle any JPEG compression. */