diff --git a/src/engine/graph_node.c b/src/engine/graph_node.c index 846be0cd..44379e0f 100644 --- a/src/engine/graph_node.c +++ b/src/engine/graph_node.c @@ -756,6 +756,10 @@ void geo_obj_init_spawninfo(struct GraphNodeObject *graphNode, struct SpawnInfo * Initialize the animation of an object node */ void geo_obj_init_animation(struct GraphNodeObject *graphNode, struct Animation **animPtrAddr) { + if (graphNode == NULL) { return; } + if (animPtrAddr == NULL) { return; } + if (*animPtrAddr == NULL) { return; } + struct Animation **animSegmented = segmented_to_virtual(animPtrAddr); struct Animation *anim = segmented_to_virtual(*animSegmented); @@ -771,6 +775,10 @@ void geo_obj_init_animation(struct GraphNodeObject *graphNode, struct Animation * Initialize the animation of an object node */ void geo_obj_init_animation_accel(struct GraphNodeObject *graphNode, struct Animation **animPtrAddr, u32 animAccel) { + if (graphNode == NULL) { return; } + if (animPtrAddr == NULL) { return; } + if (*animPtrAddr == NULL) { return; } + struct Animation **animSegmented = segmented_to_virtual(animPtrAddr); struct Animation *anim = segmented_to_virtual(*animSegmented); diff --git a/src/game/obj_behaviors.c b/src/game/obj_behaviors.c index 98b07007..e3857742 100644 --- a/src/game/obj_behaviors.c +++ b/src/game/obj_behaviors.c @@ -555,6 +555,10 @@ struct MarioState* nearest_mario_state_to_object(struct Object *obj) { checkActive = FALSE; } while (nearest == NULL); + if (nearest == NULL) { + nearest = &gMarioStates[0]; + } + return nearest; }