aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorHarry Jeffery <harry@exec64.co.uk>2015-11-09 15:27:16 +0000
committerHarry Jeffery <harry@exec64.co.uk>2015-11-09 15:27:16 +0000
commitdfda9199a45a2bb4789eb962b03cb596578d8a3d (patch)
treedb8f9a5e5e99bed2c6c2c18ab04f37bee865cef7 /main.c
parent805dc87e62cb6138da5751bd2396a2edba3cf326 (diff)
downloadimv-dfda9199a45a2bb4789eb962b03cb596578d8a3d.tar.gz
Make error logging clearer
Diffstat (limited to 'main.c')
-rw-r--r--main.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/main.c b/main.c
index ab07e36..7e7d225 100644
--- a/main.c
+++ b/main.c
@@ -285,6 +285,12 @@ void load_image(const char* path)
}
FREE_IMAGE_FORMAT fmt = FreeImage_GetFileType(path,0);
+
+ if(fmt == FIF_UNKNOWN) {
+ fprintf(stderr, "Could not identify file: '%s'. Ignoring.\n", path);
+ return;
+ }
+
if(fmt == FIF_GIF) {
load_gif(path);
return;
@@ -297,6 +303,10 @@ void load_image(const char* path)
g_img.playing = 0;
FIBITMAP *image = FreeImage_Load(fmt, path, 0);
+ if(!image) {
+ fprintf(stderr, "Error loading file: '%s'. Ignoring.\n", path);
+ return;
+ }
FIBITMAP *frame = FreeImage_ConvertTo32Bits(image);
FreeImage_FlipVertical(frame);
render_image(frame);
@@ -432,7 +442,6 @@ int main(int argc, char** argv)
while(g_path.changed) {
load_image(g_path.cur->path);
if(g_img.tex == NULL) {
- fprintf(stderr, "Ignoring unsupported file: %s\n", g_path.cur->path);
remove_current_path();
} else {
g_path.changed = 0;