From 01935edbba586df820db002671da7bd0a348ad8e Mon Sep 17 00:00:00 2001 From: Paul Elder Date: Fri, 8 Mar 2024 11:42:18 +0100 Subject: cam: capture_script: Make parseRectangles work for non-array parseRectangles currently always parses Rectangle controls as an array of Rectangles. This causes non-array Rectangle controls to not be parsed correctly, as when the ControlValue is get()ed, the non-array assertion will fail. Set the ControlValue with a single Rectangle in case a single Rectangle has been specified in the yaml capture script to fix that. Signed-off-by: Paul Elder Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham Reviewed-by: Umang Jain Signed-off-by: Kieran Bingham --- src/apps/cam/capture_script.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/apps') diff --git a/src/apps/cam/capture_script.cpp b/src/apps/cam/capture_script.cpp index 062a7258..1215713f 100644 --- a/src/apps/cam/capture_script.cpp +++ b/src/apps/cam/capture_script.cpp @@ -351,7 +351,10 @@ ControlValue CaptureScript::parseRectangles() } ControlValue controlValue; - controlValue.set(Span(rectangles)); + if (rectangles.size() == 1) + controlValue.set(rectangles.at(0)); + else + controlValue.set(Span(rectangles)); return controlValue; } -- cgit v1.2.1