Fixed a NULL pointer crash.