From bd81ec493129340b6fe3e6fe7981d3722c7f8316 Mon Sep 17 00:00:00 2001 From: chenjiahe <596360492@qq.com> Date: Wed, 24 Jul 2019 18:35:11 +0800 Subject: [PATCH] solved a bug that reading a damaged JPEG will shut the program down --- src/image.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/image.c b/src/image.c index 4a2c6baf..43d0b0cc 100644 --- a/src/image.c +++ b/src/image.c @@ -1295,8 +1295,9 @@ image load_image_stb(char *filename, int channels) int w, h, c; unsigned char *data = stbi_load(filename, &w, &h, &c, channels); if (!data) { - fprintf(stderr, "Cannot load image \"%s\"\nSTB Reason: %s\n", filename, stbi_failure_reason()); - exit(0); + fprintf(stderr, "It seems that something is wrong about the image you are loading,you will get a image in size 0*0,you can use this to skip the bad image or do something else!"); + image i; + return i; } if(channels) c = channels; int i,j,k;