diff --git a/src/core/lv_refr.c b/src/core/lv_refr.c index d5ee11e2de..e543182488 100644 --- a/src/core/lv_refr.c +++ b/src/core/lv_refr.c @@ -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 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; if(max_row > area_h) max_row = area_h;