Fix a bug in the last change

The name can be null, so I needed to check for this