Add null template check to compile method in field.js