diff --git a/src/widgets/image/lv_image.c b/src/widgets/image/lv_image.c index 3dde44ca7e..114d48a93c 100644 --- a/src/widgets/image/lv_image.c +++ b/src/widgets/image/lv_image.c @@ -820,6 +820,11 @@ static void draw_image(lv_event_t * e) if(img->h == 0 || img->w == 0) return; if(img->scale_x == 0 || img->scale_y == 0) return; + if(img->src == NULL) { + /*Do not need to draw image when src is NULL*/ + LV_LOG_TRACE("image source is NULL"); + return; + } lv_layer_t * layer = lv_event_get_layer(e); @@ -905,10 +910,6 @@ static void draw_image(lv_event_t * e) } lv_draw_label(layer, &label_dsc, coords); } - else if(img->src == NULL) { - /*Do not need to draw image when src is NULL*/ - LV_LOG_WARN("image source is NULL"); - } else { /*Trigger the error handler of image draw*/ LV_LOG_WARN("image source type is unknown");