Fix warning when event is undefined

Change-Id: I6cefab046055003d75808e24fe3913b62ae8b31a
Reviewed-by: Niels Weber <niels.weber@digia.com>