From 9836937eb1543ae024bfe098b51c02c2c744996c Mon Sep 17 00:00:00 2001 From: MysterD Date: Thu, 20 Apr 2023 21:40:35 -0700 Subject: [PATCH] Fixed crash in get_mario_spawn_type() --- src/game/area.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/game/area.c b/src/game/area.c index ca3b566f..9eed10b2 100644 --- a/src/game/area.c +++ b/src/game/area.c @@ -148,9 +148,10 @@ void print_intro_text(void) { } u32 get_mario_spawn_type(struct Object *o) { - if (o == NULL) { return 0; } + if (o == NULL || o->behavior == NULL) { return 0; } const BehaviorScript *behavior = virtual_to_segmented(0x13, o->behavior); + if (behavior == NULL) { return 0; } for (s32 i = 0; i < 20; i++) { if (sWarpBhvSpawnTable[i] == behavior) { @@ -182,7 +183,7 @@ struct ObjectWarpNode *area_get_warp_node_from_params(struct Object *o) { } void load_obj_warp_nodes(void) { - struct ObjectWarpNode *sp24; + struct ObjectWarpNode *sp24 = NULL; struct Object *sp20 = (struct Object *) gObjParentGraphNode.children; do {