summaryrefslogtreecommitdiff
path: root/camera/common/1.0/default/CameraModule.cpp
diff options
context:
space:
mode:
authorShik Chen <shik@google.com>2018-10-25 18:00:27 +0800
committerShik Chen <shik@google.com>2018-11-14 08:10:04 +0000
commitd4b8d2179f17a261b348b8a38cbc5278f8b4d45d (patch)
treeb2c201acf109c4d12e47d145317a3286d27bcb1a /camera/common/1.0/default/CameraModule.cpp
parentb106b5c863aab4adb5b7a22430fc89546b97c1b8 (diff)
Camera: Fix a crash in removeCamera()
mCameraInfoMap is a KeyedVector, we should use .valueFor() instead of operator[] to get the value from a key. Bug: 118364955 Bug: 118359878 Bug: 77833131 Test: Plug and unplug the external camera 10+ times. Change-Id: Ibf48e5a78b16bdeba08b02242379eaf571fc76cb
Diffstat (limited to 'camera/common/1.0/default/CameraModule.cpp')
-rw-r--r--camera/common/1.0/default/CameraModule.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/camera/common/1.0/default/CameraModule.cpp b/camera/common/1.0/default/CameraModule.cpp
index 392ebbc237..9c2b02ba0c 100644
--- a/camera/common/1.0/default/CameraModule.cpp
+++ b/camera/common/1.0/default/CameraModule.cpp
@@ -466,8 +466,8 @@ status_t CameraModule::filterOpenErrorCode(status_t err) {
}
void CameraModule::removeCamera(int cameraId) {
- free_camera_metadata(
- const_cast<camera_metadata_t*>(mCameraInfoMap[cameraId].static_camera_characteristics));
+ free_camera_metadata(const_cast<camera_metadata_t*>(
+ mCameraInfoMap.valueFor(cameraId).static_camera_characteristics));
mCameraInfoMap.removeItem(cameraId);
mDeviceVersionMap.removeItem(cameraId);
}