From 1ee330c05827c54884d76a53a220eca40930afe5 Mon Sep 17 00:00:00 2001 From: Benjamin Mugnier Date: Fri, 23 May 2025 11:56:56 +0200 Subject: ipa: rpi: Prevent segfault if AGC algorithm is absent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Even without AGC definition in the tuning file, the application would still dereference agc unconditionally, leading to a segmentation fault if AGC is absent. This is relevant for sensors already providing AGC/AEC by themselves. Check if AGC is present prior to setting maximum exposure time. Signed-off-by: Benjamin Mugnier Reviewed-by: Paul Elder Tested-by: Barnabás Pőcze # RPi4 + imx708_wide Reviewed-by: Naushir Patuck Signed-off-by: Kieran Bingham --- src/ipa/rpi/common/ipa_base.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp index e0a93daa..e0f8b7e7 100644 --- a/src/ipa/rpi/common/ipa_base.cpp +++ b/src/ipa/rpi/common/ipa_base.cpp @@ -1563,7 +1563,8 @@ void IpaBase::applyFrameDurations(Duration minFrameDuration, Duration maxFrameDu RPiController::AgcAlgorithm *agc = dynamic_cast( controller_.getAlgorithm("agc")); - agc->setMaxExposureTime(maxExposureTime); + if (agc) + agc->setMaxExposureTime(maxExposureTime); } void IpaBase::applyAGC(const struct AgcStatus *agcStatus, ControlList &ctrls) -- cgit v1.2.1