From 435cc3fedc4b1fbe50104313a687fc30bda23b4b Mon Sep 17 00:00:00 2001 From: _VIFEXTech <1290176185@qq.com> Date: Wed, 30 Mar 2022 19:00:48 +0800 Subject: [PATCH] fix(flex): assert before dividing by 0 (#3237) Co-authored-by: pengyiqiang --- src/extra/layouts/flex/lv_flex.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/extra/layouts/flex/lv_flex.c b/src/extra/layouts/flex/lv_flex.c index c2e2fa04e..d00134daa 100644 --- a/src/extra/layouts/flex/lv_flex.c +++ b/src/extra/layouts/flex/lv_flex.c @@ -428,6 +428,7 @@ static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, i for(i = 0; i < t->grow_item_cnt; i++) { if(t->grow_dsc[i].clamped == 0) { + LV_ASSERT(grow_value_sum != 0); grow_unit = grow_max_size / grow_value_sum; lv_coord_t size = grow_unit * t->grow_dsc[i].grow_value; lv_coord_t size_clamp = LV_CLAMP(t->grow_dsc[i].min_size, size, t->grow_dsc[i].max_size);