pawbyte / Game-Pencil-Engine-Editor

Game Pencil Engine a game engine written from the ground up.
https://gamepencil.net/
MIT License
101 stars 20 forks source link

void spatial_partition::check_for_leaving_collisions() should CONTINUE/SKIP TO NEXT if( collisions_found[i].type == collision_event_type::collision_leave ) #154

Closed nhurde closed 6 months ago

nhurde commented 6 months ago

This function has an if statement to check if the collision event is already in the leave state. The problem is that code can later be executed that references the previously deleted/erased collision event. This will cause segmentation faults and unexpected activity is the ifs below are still checked and/or valid for the next element.

When this if statement is completed, either do an else for the remaining code or do a break in the for loop.

nhurde commented 6 months ago

Merged via https://github.com/pawbyte/Game-Pencil-Engine-Editor/pull/158