From 72f363a4fb571ad6f33d531726d8d4409856fbd4 Mon Sep 17 00:00:00 2001 From: luigi__ Date: Fri, 5 Jun 2009 12:11:09 +0000 Subject: [PATCH] Fixed crash when loading files that aren't ROMs (for example when accidentally dragging some file on DeSmuME's window). --- desmume/src/NDSSystem.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/desmume/src/NDSSystem.cpp b/desmume/src/NDSSystem.cpp index 7b8b1bb2e..823e82c48 100644 --- a/desmume/src/NDSSystem.cpp +++ b/desmume/src/NDSSystem.cpp @@ -759,9 +759,12 @@ int NDS_LoadROM( const char *filename, break; } - type = ROM_NDS; - if ( !strcmp(extROM, ".gba") && !strcmp(extROM2, ".ds")) - type = ROM_DSGBA; + if ( !strcmp(extROM, ".nds")) + type = ROM_NDS; + else if ( !strcmp(extROM, ".gba") && !strcmp(extROM2, ".ds")) + type = ROM_DSGBA; + else + return -1; file = reader->Init(filename); if (!file)