diff options
author | Bert <ber.t@gmx.com> | 2011-01-20 16:24:48 +0100 |
---|---|---|
committer | Bert <ber.t@gmx.com> | 2011-01-20 16:24:48 +0100 |
commit | a732e75d8a484c9e9a1c281d93124580fad83dd4 (patch) | |
tree | 0a21e650d4185090d11b85a2f3a0e7911efd80c4 /image.c | |
parent | 004f297ebb3043032661513f40a36c1cc915bc59 (diff) | |
download | nsxiv-a732e75d8a484c9e9a1c281d93124580fad83dd4.tar.zst |
Check all given files before open the first
Diffstat (limited to 'image.c')
-rw-r--r-- | image.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -39,22 +39,26 @@ void imlib_destroy() { imlib_free_image(); } -void img_load(img_t *img, const char *filename) { +int img_load(img_t *img, const char *filename) { Imlib_Image *im; if (!img || !filename) - return; + return -1; if (imlib_context_get_image()) imlib_free_image(); - if (!(im = imlib_load_image(filename))) - DIE("could not open image: %s", filename); + if (!(im = imlib_load_image(filename))) { + WARN("could not open image: %s", filename); + return -1; + } imlib_context_set_image(im); img->w = imlib_image_get_width(); img->h = imlib_image_get_height(); + + return 0; } void img_display(img_t *img, win_t *win) { |