Fix potential NULL dereference.