Fix hook fail on api email creation

Email edit hook was crashing when we created new emails via the
CiviCRM API, since it was trying to examine properties of a null
object reference.

Change-Id: I87ad54656f1561c04e264bdcf56836406e5e6837
Merge "Fix hook fail on api email creation"