mirror of
https://github.com/lvgl/lvgl.git
synced 2026-06-05 07:13:45 +08:00
fix(refr): avoid division by zero (#7205)
This commit is contained in:
@@ -1166,6 +1166,11 @@ static uint32_t get_max_row(lv_display_t * disp, int32_t area_w, int32_t area_h)
|
|||||||
uint32_t stride = lv_draw_buf_width_to_stride(area_w, cf);
|
uint32_t stride = lv_draw_buf_width_to_stride(area_w, cf);
|
||||||
uint32_t overhead = LV_COLOR_INDEXED_PALETTE_SIZE(cf) * sizeof(lv_color32_t);
|
uint32_t overhead = LV_COLOR_INDEXED_PALETTE_SIZE(cf) * sizeof(lv_color32_t);
|
||||||
|
|
||||||
|
if(stride == 0) {
|
||||||
|
LV_LOG_WARN("Invalid stride. Value is 0");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t max_row = (uint32_t)(disp->buf_act->data_size - overhead) / stride;
|
int32_t max_row = (uint32_t)(disp->buf_act->data_size - overhead) / stride;
|
||||||
|
|
||||||
if(max_row > area_h) max_row = area_h;
|
if(max_row > area_h) max_row = area_h;
|
||||||
|
|||||||
Reference in New Issue
Block a user