X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Ffile.cpp;fp=src%2Ffile.cpp;h=22f3c8fee3d709645ffe7942fb71a2a74d296e12;hb=07e61d8dcf16099a862baee79b4ec1e06d76b3d4;hp=4b389e653503f432df0524dd22017e91d5343768;hpb=966763ef56b837b82cc3727dd95246ba6ae155ce;p=virtualjaguar diff --git a/src/file.cpp b/src/file.cpp index 4b389e6..22f3c8f 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -186,7 +186,7 @@ bool JaguarLoadFile(char * path) // // "Alpine" file loading // Since the developers were coming after us with torches and pitchforks, we decided to -// allow this kind of thing. ;-) But ONLY FOR THE DEVS, DAMMIT! O_O +// allow this kind of thing. ;-) But ONLY FOR THE DEVS, DAMMIT! >:-U O_O // bool AlpineLoadFile(char * path) { @@ -252,7 +252,15 @@ static int gzfilelength(gzFile gd) // static bool CheckExtension(const char * filename, const char * ext) { + // Sanity checking... + if ((filename == NULL) || (ext == NULL)) + return false; + const char * filenameExt = strrchr(filename, '.'); // Get the file's extension (if any) + + if (filenameExt == NULL) + return false; + return (strcasecmp(filenameExt, ext) == 0 ? true : false); }