Don't try to get no profile's name (#1155014)

If no profile is specified, trying to get its name results in a traceback.