return empty string for invalid identity (#29274)
Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -15,6 +15,9 @@ public static class Identity
|
||||
/// </summary>
|
||||
public static string Name(EntityUid uid, IEntityManager ent, EntityUid? viewer=null)
|
||||
{
|
||||
if (!uid.IsValid())
|
||||
return string.Empty;
|
||||
|
||||
var meta = ent.GetComponent<MetaDataComponent>(uid);
|
||||
if (meta.EntityLifeStage <= EntityLifeStage.Initializing)
|
||||
return meta.EntityName; // Identity component and such will not yet have initialized and may throw NREs
|
||||
|
||||
Reference in New Issue
Block a user