Fixes #3407: Prevent NPE when publishing event

Fixes #3407: Prevent NPE
fine.