aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorNebuleon Fumika2013-06-16 02:04:08 -0400
committerNebuleon Fumika2013-06-16 02:04:08 -0400
commit72db4b9ec1a88d57d7bf58f21472089cad62e1e8 (patch)
treefd9d87c314d87d4445e8e1c707c8ee3f1948cc9a /source
parenta1d1e01e11185d389f9448be0be0a567f1430600 (diff)
downloadsnesemu-72db4b9ec1a88d57d7bf58f21472089cad62e1e8.tar.gz
snesemu-72db4b9ec1a88d57d7bf58f21472089cad62e1e8.tar.bz2
snesemu-72db4b9ec1a88d57d7bf58f21472089cad62e1e8.zip
Don't crash on extensionless files. Helps GitHub issue #37 some more. Taken from DS2Compress.
Diffstat (limited to 'source')
-rw-r--r--source/nds/gui.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/source/nds/gui.c b/source/nds/gui.c
index ea76c08..a458084 100644
--- a/source/nds/gui.c
+++ b/source/nds/gui.c
@@ -965,12 +965,17 @@ s32 load_file(char **wildcards, char *result, char *default_dir_name)
else
{
char* Extension = strrchr(EntryNames[i], '.');
- if (strcasecmp(Extension, ".smc") == 0 || strcasecmp(Extension, ".sfc") == 0)
- icon = &ICON_SFCFILE;
- else if (strcasecmp(Extension, ".zip") == 0)
- icon = &ICON_ZIPFILE;
- else if (strcasecmp(Extension, ".cht") == 0)
- icon = &ICON_CHTFILE;
+ if (Extension != NULL)
+ {
+ if (strcasecmp(Extension, ".smc") == 0 || strcasecmp(Extension, ".sfc") == 0)
+ icon = &ICON_SFCFILE;
+ else if (strcasecmp(Extension, ".zip") == 0)
+ icon = &ICON_ZIPFILE;
+ else if (strcasecmp(Extension, ".cht") == 0)
+ icon = &ICON_CHTFILE;
+ else
+ icon = &ICON_UNKNOW;
+ }
else
icon = &ICON_UNKNOW;
}