From 8b02645845bf404fba83910818b285b652f14f89 Mon Sep 17 00:00:00 2001 From: Naushir Patuck Date: Wed, 20 Jul 2022 09:15:34 +0100 Subject: libcamera: controls: Suppress error message from ControlList::get() Now that ControlList::get() returns a std::optional to handle missing controls, the error log message in the call to ControlList::find() is unnecessary and likely invalid. Fix this by avoiding the call to ControlList::find() from ControlList::get() and replacing with a call to the underlying std::unordered_map::find(). Fixes: 1c4d48018505 ("libcamera: controls: Use std::optional to handle invalid control values") Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart Reviewed-by: Umang Jain Signed-off-by: Laurent Pinchart --- include/libcamera/controls.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index 85a56e62..7920abba 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -375,11 +375,12 @@ public: template std::optional get(const Control &ctrl) const { - const ControlValue *val = find(ctrl.id()); - if (!val) + const auto entry = controls_.find(ctrl.id()); + if (entry == controls_.end()) return std::nullopt; - return val->get(); + const ControlValue &val = entry->second; + return val.get(); } template -- cgit v1.2.1