diff --git a/Libraries/SPTarkov.Server.Core/Utils/RandomUtil.cs b/Libraries/SPTarkov.Server.Core/Utils/RandomUtil.cs index 2cb64fed..c240308f 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/RandomUtil.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/RandomUtil.cs @@ -115,6 +115,11 @@ public class RandomUtil(ISptLogger _logger, ICloner _cloner) // We can call `count` directly if it's a list if (collection is IList list) { + if (!list.Any()) + { + throw new InvalidOperationException("Sequence contains no elements."); + } + return list[GetInt(0, list.Count - 1)]; }