diff --git a/common/draw.c b/common/draw.c index 8071d2793..bc3ec52f9 100644 --- a/common/draw.c +++ b/common/draw.c @@ -744,8 +744,14 @@ draw_image(DrawCtx *ctx, int x, int y, int wanted_h, const char *filename) Imlib_Image image; Imlib_Load_Error e = IMLIB_LOAD_ERROR_NONE; - if(!(image = imlib_load_image_with_error_return(filename, &e))) - return warn("cannot load image %s: %s\n", filename, draw_imlib_load_strerror(e)); + if (!filename) { + warn("cannot load image"); + return; + } + if(!(image = imlib_load_image_with_error_return(filename, &e))) { + warn("cannot load image %s: %s\n", filename, draw_imlib_load_strerror(e)); + return; + } imlib_context_set_image(image); h = imlib_image_get_height(); @@ -784,6 +790,9 @@ draw_get_image_size(const char *filename) Imlib_Image image; Imlib_Load_Error e = IMLIB_LOAD_ERROR_NONE; + if (!filename) + return size; + if((image = imlib_load_image_with_error_return(filename, &e))) { imlib_context_set_image(image);