Ralith / hecs

A handy ECS
Apache License 2.0
967 stars 82 forks source link

Fix panic on inserting with some dangling Entity handles #265

Closed Ralith closed 2 years ago

Ralith commented 2 years ago

When the id of a dangling Entity is larger than any previously allocated from the world, Entities::get would erroneously judge it to be pending, leading insert to attempt access to out-of-bounds location or archetype data.

Replicates the same fix applied in https://github.com/Ralith/hecs/pull/244 to Entities::get. get_mut is left as-is as it doesn't handle pending entities.