]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - image.c
Fix an IO exception on exit when using -condebug because FS_Close was trying to log...
[xonotic/darkplaces.git] / image.c
diff --git a/image.c b/image.c
index ceecd249e999c3bf3998989c21026fb7b4e8da48..ed498ed6562ce832080410a4fc25a9378aeb4727 100644 (file)
--- a/image.c
+++ b/image.c
@@ -1084,8 +1084,10 @@ unsigned char *loadimagepixelsbgra (const char *filename, qbool complain, qbool
        for (format = firstformat;format->formatstring;format++)
        {
                dpsnprintf (name, sizeof(name), format->formatstring, basename);
-               f = FS_LoadFile(name, tempmempool, true, &filesize);
-               if (f)
+
+               FS_SanitizePath(name);
+
+               if(FS_FileExists(name) && (f = FS_LoadFile(name, tempmempool, true, &filesize)) != NULL)
                {
                        mymiplevel = miplevel ? *miplevel : 0;
                        image_width = 0;