Check for null pointers and set some default values.