Avoid NPE on user defined types which have a value of null provided by Derrick Hudson