Skip to content

Commit

Permalink
return empty string for invalid identity (#29274)
Browse files Browse the repository at this point in the history
Co-authored-by: deltanedas <@deltanedas:kde.org>
  • Loading branch information
deltanedas authored Jun 20, 2024
1 parent c336445 commit a3ffe22
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Content.Shared/IdentityManagement/Identity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a3ffe22

Please sign in to comment.