From 1781a9da06d8881944b4589ea1e151eddf735f19 Mon Sep 17 00:00:00 2001 From: themias <89101928+themias@users.noreply.github.com> Date: Wed, 24 May 2023 15:03:43 -0400 Subject: [PATCH] Fix ReplacementAccentSystem out of range exception (#16786) --- .../Speech/EntitySystems/ReplacementAccentSystem.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Content.Server/Speech/EntitySystems/ReplacementAccentSystem.cs b/Content.Server/Speech/EntitySystems/ReplacementAccentSystem.cs index 0671a25201..36fa7e07ad 100644 --- a/Content.Server/Speech/EntitySystems/ReplacementAccentSystem.cs +++ b/Content.Server/Speech/EntitySystems/ReplacementAccentSystem.cs @@ -53,8 +53,10 @@ namespace Content.Server.Speech.EntitySystems // this is kind of slow but its not that bad // essentially: go over all matches, try to match capitalization where possible, then replace // rather than using regex.replace - foreach (Match match in Regex.Matches(message, $@"(? 0; i--) { + // fetch the match again as the character indices may have changed + Match match = Regex.Match(message, $@"(?