diff options
author | Harry Jeffery <harry@exec64.co.uk> | 2015-11-09 15:27:16 +0000 |
---|---|---|
committer | Harry Jeffery <harry@exec64.co.uk> | 2015-11-09 15:27:16 +0000 |
commit | dfda9199a45a2bb4789eb962b03cb596578d8a3d (patch) | |
tree | db8f9a5e5e99bed2c6c2c18ab04f37bee865cef7 | |
parent | 805dc87e62cb6138da5751bd2396a2edba3cf326 (diff) | |
download | imv-dfda9199a45a2bb4789eb962b03cb596578d8a3d.tar.gz |
Make error logging clearer
-rw-r--r-- | main.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -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; |