summaryrefslogtreecommitdiffstats
path: root/image.c
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-01-20 16:24:48 +0100
committerBert <ber.t@gmx.com>2011-01-20 16:24:48 +0100
commita732e75d8a484c9e9a1c281d93124580fad83dd4 (patch)
tree0a21e650d4185090d11b85a2f3a0e7911efd80c4 /image.c
parent004f297ebb3043032661513f40a36c1cc915bc59 (diff)
downloadnsxiv-a732e75d8a484c9e9a1c281d93124580fad83dd4.tar.zst
Check all given files before open the first
Diffstat (limited to 'image.c')
-rw-r--r--image.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/image.c b/image.c
index 953b1c2..7b0df5d 100644
--- a/image.c
+++ b/image.c
@@ -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) {