fix segfault in is image name

This commit is contained in:
Rachel Lambda Samuelsson 2021-03-07 19:13:01 +01:00
parent b74f018721
commit a2615d01a7

View File

@ -90,9 +90,13 @@ void* xrealloc(void* ptr, size_t size) {
/* this fucks up if you name a folder .jpg or .png, but at that point you had it coming */
int is_image_name(char* f) {
char* extension = strrchr(f, '.');
if (!extension) {
return 0;
}
for (int n = 0; image_extensions[n]; n++) {
if (!strcmp(extension, image_extensions[n]))
if (!strcmp(extension, image_extensions[n])) {
return 1;
}
}
return 0;
}