Fixed crash in note_pool_clear()

This commit is contained in:
MysterD 2023-04-20 21:43:42 -07:00
parent 1d93bdae0b
commit 4dc9f0f776
1 changed files with 7 additions and 4 deletions

View File

@ -951,13 +951,16 @@ void init_note_free_list(void) {
}
void note_pool_clear(struct NotePool *pool) {
if (!pool) { return; }
s32 i;
struct AudioListItem *source;
struct AudioListItem *cur;
struct AudioListItem *dest;
struct AudioListItem *source = NULL;
struct AudioListItem *cur = NULL;
struct AudioListItem *dest = NULL;
UNUSED s32 j; // unused in EU
for (i = 0; i < 4; i++) {
source = NULL;
dest = NULL;
switch (i) {
case 0:
source = &pool->disabled;
@ -979,7 +982,7 @@ void note_pool_clear(struct NotePool *pool) {
dest = &gNoteFreeLists.active;
break;
}
if (!source || !dest) { continue; }
#if defined(VERSION_EU) || defined(VERSION_SH)
for (;;) {
cur = source->next;