greenstack / spite-framework

The Spite Framework is a C# library meant to simplify designing and implementing turn-based gameplay by providing some boilerplate code.
MIT License
6 stars 0 forks source link

Commands with a null executor cause exceptions #57

Closed greenstack closed 1 year ago

greenstack commented 2 years ago

In this particular example, the offending code can be found on line 42 of TeamPhase.cs:

return command.Executor.ResponsibleTeam == CurrentTeam &&
    (command.Executor as ITappableTeammate)?.IsTapped != true;

There should be a null check on the command.Executor property here. If the null check fails, I think raising an exception (such as a NullObjectException) with a message something along the lines of "The command's executor has not been set yet" would be great.