Why does adding the same function to an event twice crash unreal?

I have a single-argument event TickEvent, which I run from my function’s Tick() and add anything I want to temporarily run on tick to. I can add a function without problems:

TickEvent.AddUObject(this, &UCombat::FlowTowards);

However, if that line ever runs while FlowTowards() is already a member of TickEvent, the game crashes. It’s possible to put some degree of protection in to keep this from happening, but why does it happen? Is there additional protection I should be putting somewhere, like checking if TickEvent already has a method before adding it?

Ooh that’s perfect, thank you!!

You can check if TickEvent.IsBound()

or you can call RemoveUObject before AddUObject → this is deprecated and you have to use handle, you can even check if this FDelegateHandle returned by AddUObject is valid.

or you can remember somewhere in bool or bitfield that something was added to TickEvent and check it before adding.