From d35d5583aa39775111a94151383af30fa62cd100 Mon Sep 17 00:00:00 2001 From: Erik Auerswald Date: Thu, 6 Aug 2009 04:11:28 +0000 Subject: [PATCH] Change error handling if unable to load the image. This helps reading the code. --- ssocr.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ssocr.c b/ssocr.c index 12776c0..567031e 100644 --- a/ssocr.c +++ b/ssocr.c @@ -297,9 +297,12 @@ int main(int argc, char **argv) fprintf(stderr, "loading image %s\n", argv[argc-1]); } image = imlib_load_image_immediately_without_cache(argv[argc-1]); + if (!image) { + fprintf(stderr, "could not load image %s\n", argv[argc-1]); + exit(99); + } - /* if the load was successful */ - if (image) { + { /* some variables */ int w, h, lum; /* width, height, pixel luminance */ int col=UNKNOWN; /* is column dark or light? */ @@ -1022,9 +1025,6 @@ int main(int argc, char **argv) imlib_context_set_image(debug_image); imlib_free_image_and_decache(); } - } else { - fprintf(stderr, "could not load image %s\n", argv[argc-1]); - exit(99); } /* determin error code */