diff --git a/services/camera/libcameraservice/device1/CameraHardwareInterface.cpp b/services/camera/libcameraservice/device1/CameraHardwareInterface.cpp index 61cada61a97..92a4c66205c 100644 --- a/services/camera/libcameraservice/device1/CameraHardwareInterface.cpp +++ b/services/camera/libcameraservice/device1/CameraHardwareInterface.cpp @@ -228,7 +228,9 @@ hardware::Return CameraHardwareInterface::handleCallbackTimestampBatch( msgs.push_back({hidl_msg.timestamp, mem->mBuffers[hidl_msg.bufferIndex]}); } } - mDataCbTimestampBatch((int32_t) msgType, msgs, mCbUser); + if (mDataCbTimestampBatch != nullptr) { + mDataCbTimestampBatch((int32_t) msgType, msgs, mCbUser); + } return hardware::Void(); } @@ -777,7 +779,9 @@ void CameraHardwareInterface::sNotifyCb(int32_t msg_type, int32_t ext1, ALOGV("%s", __FUNCTION__); CameraHardwareInterface *object = static_cast(user); - object->mNotifyCb(msg_type, ext1, ext2, object->mCbUser); + if (object->mNotifyCb != nullptr) { + object->mNotifyCb(msg_type, ext1, ext2, object->mCbUser); + } } void CameraHardwareInterface::sDataCb(int32_t msg_type, @@ -794,7 +798,9 @@ void CameraHardwareInterface::sDataCb(int32_t msg_type, index, mem->mNumBufs); return; } - object->mDataCb(msg_type, mem->mBuffers[index], metadata, object->mCbUser); + if (object->mDataCb != nullptr){ + object->mDataCb(msg_type, mem->mBuffers[index], metadata, object->mCbUser); + } } void CameraHardwareInterface::sDataCbTimestamp(nsecs_t timestamp, int32_t msg_type, @@ -813,7 +819,9 @@ void CameraHardwareInterface::sDataCbTimestamp(nsecs_t timestamp, int32_t msg_ty index, mem->mNumBufs); return; } - object->mDataCbTimestamp(timestamp, msg_type, mem->mBuffers[index], object->mCbUser); + if (object->mDataCbTimestamp != nullptr) { + object->mDataCbTimestamp(timestamp, msg_type, mem->mBuffers[index], object->mCbUser); + } } camera_memory_t* CameraHardwareInterface::sGetMemory(