mirror of
https://github.com/lvgl/lvgl.git
synced 2024-11-27 19:53:42 +08:00
fix(style): runtime error: applying zero offset to null pointer (#4468)
Signed-off-by: XiaoweiYan <yanxiaowei@xiaomi.com> Co-authored-by: XiaoweiYan <yanxiaowei@xiaomi.com>
This commit is contained in:
parent
8a1396d770
commit
44a36354e8
@ -286,8 +286,11 @@ void lv_style_set_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_value_
|
||||
|
||||
LV_ASSERT(prop != LV_STYLE_PROP_INV);
|
||||
|
||||
lv_style_prop_t * props = (lv_style_prop_t *)style->values_and_props + style->prop_cnt * sizeof(lv_style_value_t);
|
||||
lv_style_prop_t * props;
|
||||
int32_t i;
|
||||
|
||||
if(style->values_and_props) {
|
||||
props = (lv_style_prop_t *)style->values_and_props + style->prop_cnt * sizeof(lv_style_value_t);
|
||||
for(i = style->prop_cnt - 1; i >= 0; i--) {
|
||||
if(props[i] == prop) {
|
||||
lv_style_value_t * values = (lv_style_value_t *)style->values_and_props;
|
||||
@ -295,6 +298,7 @@ void lv_style_set_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_value_
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
size_t size = (style->prop_cnt + 1) * (sizeof(lv_style_value_t) + sizeof(lv_style_prop_t));
|
||||
uint8_t * values_and_props = lv_realloc(style->values_and_props, size);
|
||||
|
Loading…
Reference in New Issue
Block a user