From 2c1c1a0a6cb69cf5714dba9a7e548916b3b9406c Mon Sep 17 00:00:00 2001 From: qeed Date: Fri, 17 Sep 2010 18:56:17 +0000 Subject: [PATCH] added proper file checking for opening files --- src/state.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/state.cpp b/src/state.cpp index ef8b5db5..c9d3c177 100644 --- a/src/state.cpp +++ b/src/state.cpp @@ -557,7 +557,7 @@ int FCEUSS_LoadFP_old(EMUFILE* is, ENUM_SSLOADPARAMS params) { FCEUMOV_PreLoad(); } - is->fread((char*)&header,16); + is->fread((char*)&header,16); if(memcmp(header,"FCS",3)) { return(0); @@ -720,10 +720,10 @@ bool FCEUSS_Load(const char *fname) { strcpy(fn, FCEU_MakeFName(FCEUMKF_STATE,CurrentState,fname).c_str()); st=FCEUD_UTF8_fstream(fn,"rb"); - strcpy(lastLoadstateMade,fn); + strcpy(lastLoadstateMade,fn); } - if(st == NULL) + if(st == NULL || (st->get_fp() == NULL)) { FCEU_DispMessage("State %d load error.",0,CurrentState); SaveStateStatus[CurrentState]=0;