diff --git a/src/game/mario_misc.c b/src/game/mario_misc.c index 35e842e2..9cb9f0ff 100644 --- a/src/game/mario_misc.c +++ b/src/game/mario_misc.c @@ -563,6 +563,7 @@ Gfx* geo_switch_mario_cap_effect(s32 callContext, struct GraphNode* node, UNUSED * Also sets the visibility of the wing cap wings on or off. */ Gfx* geo_switch_mario_cap_on_off(s32 callContext, struct GraphNode* node, UNUSED Mat4* c) { + if (!node) { return NULL; } struct GraphNode* next = node->next; struct GraphNodeSwitchCase* switchCase = (struct GraphNodeSwitchCase*) node; struct MarioBodyState* bodyState = geo_get_body_state(); @@ -570,7 +571,7 @@ Gfx* geo_switch_mario_cap_on_off(s32 callContext, struct GraphNode* node, UNUSED if (callContext == GEO_CONTEXT_RENDER) { if (switchCase == NULL || bodyState == NULL) { return NULL; } switchCase->selectedCase = bodyState->capState & 1; - while (next != node) { + while (next && (next != node)) { if (next->type == GRAPH_NODE_TYPE_TRANSLATION_ROTATION) { if (bodyState->capState & 2) { next->flags |= GRAPH_RENDER_ACTIVE;