Fixes #3407: Prevent NPE when publishing event

Fixes #3407: Prevent NPE
Perhaps it would even be better to make sure that the UUID of the endpoint is always set. WDYT.