mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
solved a bug that reading a damaged JPEG will shut the program down
This commit is contained in:
parent
61c9d02ec4
commit
bd81ec4931
@ -1295,8 +1295,9 @@ image load_image_stb(char *filename, int channels)
|
|||||||
int w, h, c;
|
int w, h, c;
|
||||||
unsigned char *data = stbi_load(filename, &w, &h, &c, channels);
|
unsigned char *data = stbi_load(filename, &w, &h, &c, channels);
|
||||||
if (!data) {
|
if (!data) {
|
||||||
fprintf(stderr, "Cannot load image \"%s\"\nSTB Reason: %s\n", filename, stbi_failure_reason());
|
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!");
|
||||||
exit(0);
|
image i;
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
if(channels) c = channels;
|
if(channels) c = channels;
|
||||||
int i,j,k;
|
int i,j,k;
|
||||||
|
Loading…
Reference in New Issue
Block a user