Fixed crash in geo_switch_mario_cap_on_off()

This commit is contained in:
MysterD 2023-04-22 01:53:04 -07:00
parent e212a111dd
commit 619eba7527

View file

@ -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. * 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) { 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 GraphNode* next = node->next;
struct GraphNodeSwitchCase* switchCase = (struct GraphNodeSwitchCase*) node; struct GraphNodeSwitchCase* switchCase = (struct GraphNodeSwitchCase*) node;
struct MarioBodyState* bodyState = geo_get_body_state(); 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 (callContext == GEO_CONTEXT_RENDER) {
if (switchCase == NULL || bodyState == NULL) { return NULL; } if (switchCase == NULL || bodyState == NULL) { return NULL; }
switchCase->selectedCase = bodyState->capState & 1; switchCase->selectedCase = bodyState->capState & 1;
while (next != node) { while (next && (next != node)) {
if (next->type == GRAPH_NODE_TYPE_TRANSLATION_ROTATION) { if (next->type == GRAPH_NODE_TYPE_TRANSLATION_ROTATION) {
if (bodyState->capState & 2) { if (bodyState->capState & 2) {
next->flags |= GRAPH_RENDER_ACTIVE; next->flags |= GRAPH_RENDER_ACTIVE;