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

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