Fixed crash in mod_clear()
This commit is contained in:
parent
c90e89b4fb
commit
14c975ca1f
|
@ -152,15 +152,19 @@ void mod_activate(struct Mod* mod) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void mod_clear(struct Mod* mod) {
|
void mod_clear(struct Mod* mod) {
|
||||||
for (int j = 0; j < mod->fileCount; j++) {
|
if (!mod) { return; }
|
||||||
struct ModFile* file = &mod->files[j];
|
|
||||||
if (file->fp != NULL) {
|
if (mod->files) {
|
||||||
fclose(file->fp);
|
for (int j = 0; j < mod->fileCount; j++) {
|
||||||
file->fp = NULL;
|
struct ModFile* file = &mod->files[j];
|
||||||
}
|
if (file->fp != NULL) {
|
||||||
if (file->cachedPath != NULL) {
|
fclose(file->fp);
|
||||||
free((char*)file->cachedPath);
|
file->fp = NULL;
|
||||||
file->cachedPath = NULL;
|
}
|
||||||
|
if (file->cachedPath != NULL) {
|
||||||
|
free((char*)file->cachedPath);
|
||||||
|
file->cachedPath = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue