StatsHelix / demoinfo

A library to analyze CS:GO demos in C#
MIT License
322 stars 78 forks source link

Exception thrown for game event "inferno_expire" #155

Open rakijah opened 5 years ago

rakijah commented 5 years ago

I'm getting an exception when parsing a particular demo in GameEventHandler line 247 because the entityID is not found in the dictionary:

fireEndArgs.ThrownBy = parser.InfernoOwners[entityID];

The exception occurs on tick 66 during warmup.

My guess: a molotov was thrown by a bot before the demo recording started. Then, while the molotov was burning, the bot got replaced by a player and demo recording started. Then the molotov stopped burning but the owners ID was never recorded in the demo.

Sounds like a rare edge case that would be solved via a simple parser.InfernoOwners.ContainsKey(entityID) check, but I don't know enough about your code base to confidently submit that as a pull request.

main-- commented 5 years ago

Your explanation makes sense, this is one of the (multiple) problems that arise from the fact that molotovs are networked this way. The fix you describe looks correct to me, keeping the ThrownBy as null whenever we can't figure out the owner. Feel free to submit the pull request!