Draw: fix some Imlib warnings

Using an iconbox without an image caused a warning from imlib.

Signed-off-by: Gregor Best <gbe@ring0.de>
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Gregor Best 2013-05-21 19:15:11 +02:00 committed by Julien Danjou
parent 396ebe5d0b
commit c8255ca554
1 changed files with 11 additions and 2 deletions

View File

@ -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);