From 58b69b912ad5be8434a2dc41e0da644c37f56c10 Mon Sep 17 00:00:00 2001 From: zeromus Date: Wed, 3 May 2017 19:32:02 -0500 Subject: [PATCH] winport: fix crash opening nonexistent recent rom (fixes #67) --- desmume/src/frontend/windows/OpenArchive.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/desmume/src/frontend/windows/OpenArchive.cpp b/desmume/src/frontend/windows/OpenArchive.cpp index 788ed07b8..236eb0f30 100644 --- a/desmume/src/frontend/windows/OpenArchive.cpp +++ b/desmume/src/frontend/windows/OpenArchive.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2009-2016 DeSmuME team + Copyright (C) 2009-2017 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -419,6 +419,7 @@ bool ObtainFile(const char* Name, char *const & LogicalName, char *const & Physi //before sending to FEX, see if we're known to be an NDS file //(this will stop games beginning with the name ZOO from being mis-recognized as a zoo file) FILE* inf = fopen(PhysicalName,"rb"); + if(!inf) return false; u8 bytes512[512]; bool got512 = fread(bytes512,1,512,inf)==512; fclose(inf);