PazerOP / CastingEssentials

A Team Fortress 2 client plugin that enhances the experience of both casters and viewers.
https://Essentials.tf
BSD 2-Clause "Simplified" License
29 stars 12 forks source link

Improve error handling in TickAllModules #89

Closed dalegaard closed 6 years ago

dalegaard commented 6 years ago

If a module throws an exception during OnTick the client will crash. This could happen if module has not been updated and CheckDependencies didn't capture all dependencies.

Here we refactor the tick loop so OnTick is wrapped in a try...catch block. If a module throws an exception, it will be removed from the module list.

I checked the assembly of this, and benchmarked it, to ensure that there's no performance loss by doing this compared to the existing solution. I've seen no performance drops in testing, and the assembly looks effficient(more instructions, but most will be predicted).