Return null when a node doesn't have a template

Return null when a node doesn't have a template instead of a "object not
set to an instance of an object" exception