From: Inki Dae Date: Fri, 15 Mar 2024 08:09:00 +0000 (+0900) Subject: fix seg. fault with no detection X-Git-Tag: accepted/tizen/unified/20240903.110722~78^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=db75cb788d4da8ff10ec9991067a73c6c0787f5d;p=platform%2Fcore%2Fapi%2Fsingleo.git fix seg. fault with no detection Fix a seg. fault issue when detection failed by updating the result only in case that object is detected. Signed-off-by: Inki Dae --- diff --git a/services/auto_zoom/src/AutoZoom.cpp b/services/auto_zoom/src/AutoZoom.cpp index 1c0500b..a2ced5a 100644 --- a/services/auto_zoom/src/AutoZoom.cpp +++ b/services/auto_zoom/src/AutoZoom.cpp @@ -153,12 +153,16 @@ void AutoZoom::updateResult() if (_task_type == TaskType::OBJECT_DETECTION) { const vector &result = output_data.getOdResult(); - rect = result[0].rect; - result_cnt = result.size(); + if (!result.empty()) { + rect = result[0].rect; + result_cnt = result.size(); + } } else { const vector &result = output_data.getFdResult(); - rect = result[0].rect; - result_cnt = result.size(); + if (!result.empty()) { + rect = result[0].rect; + result_cnt = result.size(); + } } // TODO. implement Postprocessor which calculates Autozoom position using above 'result' vector.