Merge "Add check for null pointer to avoid crash."