fix(draw_buf): runtime error: applying non-zero offset 3 to null pointer (#4471)

Signed-off-by: XiaoweiYan <yanxiaowei@xiaomi.com>
Co-authored-by: XiaoweiYan <yanxiaowei@xiaomi.com>
This commit is contained in:
bjsylvia
2023-08-20 04:23:01 +08:00
committed by GitHub
parent a711c8b427
commit 21f3659559

View File

@@ -70,8 +70,10 @@ void lv_draw_buf_free(lv_draw_buf_t * draw_buf)
void * lv_draw_buf_get_buf(lv_draw_buf_t * draw_buf)
{
uint8_t * buf = draw_buf->buf;
buf += LV_DRAW_BUF_ALIGN - 1;
buf = (uint8_t *)((lv_uintptr_t) buf & ~(LV_DRAW_BUF_ALIGN - 1));
if(buf) {
buf += LV_DRAW_BUF_ALIGN - 1;
buf = (uint8_t *)((lv_uintptr_t) buf & ~(LV_DRAW_BUF_ALIGN - 1));
}
return buf;
}