diff --git a/Content.Server/Store/Conditions/BuyerDepartmentCondition.cs b/Content.Server/Store/Conditions/BuyerDepartmentCondition.cs index 43175b6a80c041..a71adc4e7797ac 100644 --- a/Content.Server/Store/Conditions/BuyerDepartmentCondition.cs +++ b/Content.Server/Store/Conditions/BuyerDepartmentCondition.cs @@ -37,38 +37,35 @@ public override bool Condition(ListingConditionArgs args) return true; var jobs = ent.System(); - if (jobs.MindTryGetJob(mindId, out var job, out _)) + jobs.MindTryGetJob(mindId, out var job, out _); + + if (Blacklist != null && job?.PrototypeId != null) { - if (Blacklist != null) + foreach (var department in prototypeManager.EnumeratePrototypes()) { - foreach (var department in prototypeManager.EnumeratePrototypes()) - { - if (job.PrototypeId == null || - !department.Roles.Contains(job.PrototypeId) || - !Blacklist.Contains(department.ID)) - continue; - + if (department.Roles.Contains(job.PrototypeId) && Blacklist.Contains(department.ID)) return false; - } } + } - if (Whitelist != null) + if (Whitelist != null) + { + var found = false; + + if (job?.PrototypeId != null) { - var found = false; foreach (var department in prototypeManager.EnumeratePrototypes()) { - if (job.PrototypeId == null || - !department.Roles.Contains(job.PrototypeId) || - !Whitelist.Contains(department.ID)) - continue; - - found = true; - break; + if (department.Roles.Contains(job.PrototypeId) && Whitelist.Contains(department.ID)) + { + found = true; + break; + } } - - if (!found) - return false; } + + if (!found) + return false; } return true; diff --git a/Content.Server/Store/Conditions/BuyerJobCondition.cs b/Content.Server/Store/Conditions/BuyerJobCondition.cs index 47227cf79c89a0..f5013008abf23e 100644 --- a/Content.Server/Store/Conditions/BuyerJobCondition.cs +++ b/Content.Server/Store/Conditions/BuyerJobCondition.cs @@ -34,19 +34,18 @@ public override bool Condition(ListingConditionArgs args) return true; var jobs = ent.System(); - if (jobs.MindTryGetJob(mindId, out var job, out _)) + jobs.MindTryGetJob(mindId, out var job, out _); + + if (Blacklist != null) + { + if (job?.PrototypeId != null && Blacklist.Contains(job.PrototypeId)) + return false; + } + + if (Whitelist != null) { - if (Blacklist != null) - { - if (job.PrototypeId != null && Blacklist.Contains(job.PrototypeId)) - return false; - } - - if (Whitelist != null) - { - if (job.PrototypeId == null || !Whitelist.Contains(job.PrototypeId)) - return false; - } + if (job?.PrototypeId == null || !Whitelist.Contains(job.PrototypeId)) + return false; } return true;