summaryrefslogtreecommitdiff
path: root/soh/src/code/code_800EC960.c
diff options
context:
space:
mode:
Diffstat (limited to 'soh/src/code/code_800EC960.c')
-rw-r--r--soh/src/code/code_800EC960.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/soh/src/code/code_800EC960.c b/soh/src/code/code_800EC960.c
index 9a67981ea..8e1694b7c 100644
--- a/soh/src/code/code_800EC960.c
+++ b/soh/src/code/code_800EC960.c
@@ -4527,12 +4527,17 @@ void Audio_PlayFanfare(u16 seqId)
sp26 = func_800FA0B4(SEQ_PLAYER_FANFARE);
sp1C = func_800E5E84(sp26 & 0xFF, &sp20);
sp18 = func_800E5E84(seqId & 0xFF, &sp20);
- if ((sp26 == NA_BGM_DISABLED) || (*sp1C == *sp18)) {
- D_8016B9F4 = 1;
- } else {
- D_8016B9F4 = 5;
- Audio_SeqCmd1(SEQ_PLAYER_FANFARE, 0);
- }
+ if (!sp1C || !sp18) {
+ // disable BGM, we're about to null deref!
+ D_8016B9F4 = 1;
+ } else {
+ if ((sp26 == NA_BGM_DISABLED) || (*sp1C == *sp18)) {
+ D_8016B9F4 = 1;
+ } else {
+ D_8016B9F4 = 5;
+ Audio_SeqCmd1(SEQ_PLAYER_FANFARE, 0);
+ }
+ }
D_8016B9F6 = seqId;
}