Skip to content

Commit

Permalink
Merge pull request #663 from cawtds/ub-fix-camera-object
Browse files Browse the repository at this point in the history
Fix for potential UB in CameraObjectReset2
  • Loading branch information
GriffinRichards authored Aug 29, 2024
2 parents f155bf5 + 466a69a commit 4f7b8c5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/event_object_movement.c
Original file line number Diff line number Diff line change
Expand Up @@ -2453,7 +2453,12 @@ u8 CameraObjectGetFollowedObjectId(void)

void CameraObjectReset2(void)
{
FindCameraObject()->data[1] = 2;
struct Sprite *cameraObject = FindCameraObject();
#ifdef UBFIX
if (cameraObject == NULL)
return;
#endif
cameraObject->data[1] = 2;
}

u8 CopySprite(struct Sprite *sprite, s16 x, s16 y, u8 subpriority)
Expand Down

0 comments on commit 4f7b8c5

Please sign in to comment.