Battle-Modders / mod-reforged

The main repository for the Battle Brothers Reforged mod.
16 stars 0 forks source link

fix: crash when viewing tooltip while the entity is moving #585

Open Darxo opened 3 weeks ago

Darxo commented 3 weeks ago

This fix is in reponse to the discord post: https://discord.com/channels/1006908336991645757/1283857645492502549/1302361610764947557

I got this crash. Crashed right as the Ancient Dead used rotation, and I think what caused it is that I happened to have my cursor (with the tooltip open) when they did the Rotation. image


Unfortunately the user did not provide a log. I don't know what the root cause of this issue is. One of the issues here is that the vanilla function tactical_helper_findGroundItem is being called with an _entity, which is currently moving. That will cause a crash because vanilla does a .getTile() call on the entity. That symptom might be fixed with this PR.

It would be cleaner if we [also] add a isPlacedOnMap check further up the chain of function calls. But we have not enough information to know where it started. the getTooltip function from the actor can't be the beginning, because we also do a `isPlacedOnMap check there:

image