Fix an issue that will crash if messageRecievedBlock or eventRecievedBlock were not set

Signed-off-by: Luca Bernardi <luka.bernardi@gmail.com>