diff --git a/Libraries/SPTarkov.Server.Core/Models/Common/MongoId.cs b/Libraries/SPTarkov.Server.Core/Models/Common/MongoId.cs index b547fedb..5ce6ba3b 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Common/MongoId.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Common/MongoId.cs @@ -1,15 +1,14 @@ using System.Runtime.CompilerServices; -using System.Text.RegularExpressions; using SPTarkov.Server.Core.Extensions; namespace SPTarkov.Server.Core.Models.Common; -public readonly partial struct MongoId : IEquatable +public readonly struct MongoId : IEquatable { private readonly string _stringId; public MongoId( - string id, + string? id, // TODO: TEMPORARY REMOVE ME WHEN DONE!!!! [CallerFilePath] string callerFilePath = "", [CallerMemberName] string methodName = "", @@ -17,9 +16,11 @@ public readonly partial struct MongoId : IEquatable ) { // This is temporary, otherwise item buying is broken as when LINQ searches for string id's it's possible null is passed - if (id == null) + if (string.IsNullOrEmpty(id)) { - id = string.Empty; + _stringId = string.Intern("000000000000000000000000"); + + return; } if (id.Length != 24) @@ -92,7 +93,7 @@ public readonly partial struct MongoId : IEquatable { if (other is null) { - return other == this; + return this == null; } return other.Equals(ToString(), StringComparison.InvariantCultureIgnoreCase);