Skip to content

Commit 59a83e0

Browse files
authored
fix: add null-tolerant length checks (AscensionGameDev#1998)
* fix: add null-tolerant length check * fix: null-tolerant lookup
1 parent e24f2f0 commit 59a83e0

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

Intersect (Core)/GameObjects/ItemBase.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,8 @@ public static ItemBase[] GetCooldownGroup(string cooldownGroup)
376376
return Array.Empty<ItemBase>();
377377
}
378378

379-
return Lookup
380-
.Where(i => ((ItemBase)i.Value).CooldownGroup.Trim() == cooldownGroup)
381-
.Select(i => (ItemBase)i.Value)
379+
return Lookup.Values.OfType<ItemBase>()
380+
.Where(descriptor => descriptor.CooldownGroup?.Trim() == cooldownGroup)
382381
.ToArray();
383382
}
384383

Intersect.Server.Core/Entities/Player.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6719,7 +6719,7 @@ public void UpdateCooldown(ItemBase item)
67196719
}
67206720

67216721
// Are we dealing with a cooldown group?
6722-
if (item.CooldownGroup.Trim().Length > 0)
6722+
if (!string.IsNullOrWhiteSpace(item.CooldownGroup))
67236723
{
67246724
// Yes, so handle it!
67256725
UpdateCooldownGroup(GameObjectType.Item, item.CooldownGroup, item.Cooldown, item.IgnoreCooldownReduction);

0 commit comments

Comments
 (0)