TheSHEEEP / godotdetour

A GDNative implementation of the detour/detourcrowd library for Godot.
MIT License
120 stars 19 forks source link

Fix crash when nullptr is passed to DetourNavigation::removeAgent #3

Closed chriscavalluzzi closed 4 years ago

chriscavalluzzi commented 4 years ago

Fixes a hard-crash that would occur when a nullptr was passed to DetourNavigation::removeAgent(Ref<DetourCrowdAgent> agent), which would then attempt to call DetourCrowdAgent::destroy() on it.

I encountered this crash when destroying an agent that was in an invalid state (e.g. not close enough to the navigation mesh for dtNavMeshQuery::findNearestPoly to return a result).

TheSHEEEP commented 4 years ago

Makes sense, good catch, thanks.