mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-10-18 19:22:41 +00:00
Fixed crash in mod_clear()
This commit is contained in:
parent
9ffd99473d
commit
41b226f9a7
1 changed files with 13 additions and 9 deletions
|
@ -152,15 +152,19 @@ void mod_activate(struct Mod* mod) {
|
|||
}
|
||||
|
||||
void mod_clear(struct Mod* mod) {
|
||||
for (int j = 0; j < mod->fileCount; j++) {
|
||||
struct ModFile* file = &mod->files[j];
|
||||
if (file->fp != NULL) {
|
||||
fclose(file->fp);
|
||||
file->fp = NULL;
|
||||
}
|
||||
if (file->cachedPath != NULL) {
|
||||
free((char*)file->cachedPath);
|
||||
file->cachedPath = NULL;
|
||||
if (!mod) { return; }
|
||||
|
||||
if (mod->files) {
|
||||
for (int j = 0; j < mod->fileCount; j++) {
|
||||
struct ModFile* file = &mod->files[j];
|
||||
if (file->fp != NULL) {
|
||||
fclose(file->fp);
|
||||
file->fp = NULL;
|
||||
}
|
||||
if (file->cachedPath != NULL) {
|
||||
free((char*)file->cachedPath);
|
||||
file->cachedPath = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue