From a8f1d82b6628853e2ccb40f8fee603e5a7af528a Mon Sep 17 00:00:00 2001 From: Benign X <1341398182@qq.com> Date: Sat, 20 Jan 2024 01:07:52 +0800 Subject: [PATCH] fix(display): fix incorrect assert conditions (#5400) --- src/display/lv_display.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/display/lv_display.c b/src/display/lv_display.c index cfaacf200..d67a9a44b 100644 --- a/src/display/lv_display.c +++ b/src/display/lv_display.c @@ -413,15 +413,13 @@ void lv_display_set_buffers(lv_display_t * disp, void * buf1, void * buf2, uint3 if(render_mode == LV_DISPLAY_RENDER_MODE_PARTIAL) { /* for partial mode, we calculate the height based on the buf_size and stride */ h = buf_size / stride; + LV_ASSERT_MSG(h != 0, "the buffer is too small"); } else { - LV_ASSERT_MSG(stride * h < buf_size, "%s mode requires screen sized buffer(s)", + LV_ASSERT_MSG(stride * h <= buf_size, "%s mode requires screen sized buffer(s)", render_mode == LV_DISPLAY_RENDER_MODE_FULL ? "FULL" : "DIRECT"); - return; } - LV_ASSERT_MSG(h != 0, "the buffer is too small"); - lv_draw_buf_init(&disp->_static_buf1, w, h, cf, stride, buf1, buf_size); lv_draw_buf_init(&disp->_static_buf2, w, h, cf, stride, buf2, buf_size); lv_display_set_draw_buffers(disp, &disp->_static_buf1, buf2 ? &disp->_static_buf2 : NULL);