Fixed a potential dereferencing of a null pointer.