diff --git a/src/gba/Cheats.cpp b/src/gba/Cheats.cpp index de48d605..7f3dc06f 100644 --- a/src/gba/Cheats.cpp +++ b/src/gba/Cheats.cpp @@ -2040,9 +2040,14 @@ bool cheatsImportGSACodeFile(const char* name, int game, bool v3) return false; int games = 0; - int len = 0; fseek(f, 0x1e, SEEK_CUR); - fread(&games, 1, 4, f); + if(fread(&games, 1, 4, f) == 0) + { + fclose(f); + return false; + } + + int len = 0; bool found = false; int g = 0; while (games > 0) {