Fixed crash in note_pool_clear()

This commit is contained in:
MysterD 2023-04-20 21:43:42 -07:00
parent 9836937eb1
commit 43e63b854b

View file

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