Call the hook only if it not null.
Fix use before null check.

Signed-off-by: Srikrishan Malik <srimalik@in.ibm.com>