summaryrefslogtreecommitdiff
path: root/src/android/camera_hal_manager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/android/camera_hal_manager.cpp')
-rw-r--r--src/android/camera_hal_manager.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/android/camera_hal_manager.cpp b/src/android/camera_hal_manager.cpp
index a1805ebc..05b47401 100644
--- a/src/android/camera_hal_manager.cpp
+++ b/src/android/camera_hal_manager.cpp
@@ -29,7 +29,7 @@ LOG_DECLARE_CATEGORY(HAL);
*/
CameraHalManager::CameraHalManager()
- : cameraManager_(nullptr), numInternalCameras_(0),
+ : cameraManager_(nullptr), callbacks_(nullptr), numInternalCameras_(0),
nextExternalCameraId_(firstExternalCameraId_)
{
}
@@ -70,6 +70,11 @@ CameraDevice *CameraHalManager::open(unsigned int id,
{
MutexLocker locker(mutex_);
+ if (!callbacks_) {
+ LOG(HAL, Error) << "Can't open camera before callbacks are set";
+ return nullptr;
+ }
+
CameraDevice *camera = cameraDeviceFromHalId(id);
if (!camera) {
LOG(HAL, Error) << "Invalid camera id '" << id << "'";