From: cloudwalk Date: Sun, 8 Nov 2020 06:25:13 +0000 (+0000) Subject: image: Check if file exists first to allow early out and avoid a slower codepath X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5297b46dcb238b0e738e2bad7ea5b34413d361a8;p=xonotic%2Fdarkplaces.git image: Check if file exists first to allow early out and avoid a slower codepath git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13040 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/image.c b/image.c index ceecd249..9f07ce60 100644 --- a/image.c +++ b/image.c @@ -1084,8 +1084,7 @@ 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) + if(FS_FileExists(name) && (f = FS_LoadFile(name, tempmempool, true, &filesize)) != NULL) { mymiplevel = miplevel ? *miplevel : 0; image_width = 0;