Null check before dereferencing datatype