diff --git a/src/Client/PlayerState.cs b/src/Client/PlayerState.cs index b24c6bd..9c1dbb1 100644 --- a/src/Client/PlayerState.cs +++ b/src/Client/PlayerState.cs @@ -56,7 +56,17 @@ public sealed class PlayerState /// No option with was found. public PlayerOption GetOption(string id) { - return Options.FirstOrDefault(o => string.Equals(o.Id, id, StringComparison.OrdinalIgnoreCase)) - ?? throw new KeyNotFoundException($"Option with id '{id}' is not found."); + PlayerOption? result = null; + + foreach (var option in Options) + { + if (string.Equals(option.Id, id, StringComparison.OrdinalIgnoreCase)) + { + result = option; + break; + } + } + + return result ?? throw new KeyNotFoundException($"Option with id '{id}' is not found."); } }