- bugfixes on windows platform when some folders and files are missing, do not crash hard.

This commit is contained in:
SoftCoder 2013-12-27 23:05:20 -08:00
parent 163a5a173a
commit b6cd751250
6 changed files with 12 additions and 12 deletions

View File

@ -1470,7 +1470,7 @@ void CoreData::saveGameSettingsToFile(std::string fileName, GameSettings *gameSe
}
#if defined(WIN32) && !defined(__MINGW32__)
fclose(fp);
if(fp) fclose(fp);
#endif
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
}

View File

@ -200,7 +200,7 @@ string MenuStateAbout::loadAdditionalCredits(){
std::cout << buffer << std::endl;
file.close();
#if defined(WIN32) && !defined(__MINGW32__)
fclose(fp);
if(fp) fclose(fp);
#endif
}
return result;

View File

@ -171,14 +171,14 @@ static inline T* readFromFileReaders(vector<FileReader<T> const *>* readers, con
if (ret != NULL) {
file.close();
#if defined(WIN32) && !defined(__MINGW32__)
fclose(fp);
if(fp) fclose(fp);
#endif
return ret;
}
}
file.close();
#if defined(WIN32) && !defined(__MINGW32__)
fclose(fp);
if(fp) fclose(fp);
#endif
return NULL;
@ -223,14 +223,14 @@ static inline T* readFromFileReaders(vector<FileReader<T> const *>* readers, con
if (ret != NULL) {
file.close();
#if defined(WIN32) && !defined(__MINGW32__)
fclose(fp);
if(fp) fclose(fp);
#endif
return ret;
}
}
file.close();
#if defined(WIN32) && !defined(__MINGW32__)
fclose(fp);
if(fp) fclose(fp);
#endif
return NULL;
}
@ -368,7 +368,7 @@ T* FileReader<T>::read(const string& filepath) const {
T* ret = read(file,filepath);
file.close();
#if defined(WIN32) && !defined(__MINGW32__)
fclose(fp);
if(fp) fclose(fp);
#endif
return ret;
@ -393,7 +393,7 @@ T* FileReader<T>::read(const string& filepath, T* object) const {
T* ret = read(file,filepath,object);
file.close();
#if defined(WIN32) && !defined(__MINGW32__)
fclose(fp);
if(fp) fclose(fp);
#endif
return ret;

View File

@ -883,7 +883,7 @@ void MapPreview::loadFromFile(const string &path) {
}
}
fclose(f1);
if(f1) fclose(f1);
fileLoaded = true;
mapFileLoaded = path;
@ -964,7 +964,7 @@ void MapPreview::saveToFile(const string &path) {
}
}
fclose(f1);
if(f1) fclose(f1);
hasChanged = false;
}

View File

@ -63,7 +63,7 @@ void AllocRegistry::dump(const char *path) {
fprintf(f, "Total allocations: %d, " MG_SIZE_T_SPECIFIER " bytes\n", allocCount, allocBytes);
fprintf(f, "Not monitored allocations: %d, " MG_SIZE_T_SPECIFIER " bytes\n", nonMonitoredCount, nonMonitoredBytes);
fclose(f);
if(f) fclose(f);
printf("Memory leak dump summary at: %s\n",szBuf2);
printf("Total leaks: %d, " MG_SIZE_T_SPECIFIER " bytes\n", leakCount, leakBytes);

View File

@ -376,7 +376,7 @@ void Properties::save(const string &path){
fileStream.close();
#if defined(WIN32) && !defined(__MINGW32__)
fclose(fp);
if(fp) fclose(fp);
#endif
}