Fixed crash in geo_obj_init_animation*

This commit is contained in:
MysterD 2022-02-18 21:11:16 -08:00
parent 1f61f2f632
commit d63f7d4814
2 changed files with 12 additions and 0 deletions

View File

@ -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);

View File

@ -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;
}