fixes #2051 Editing an Event from a page throws Null Pointer Exception

Fixed the issue committed code for review please check it.