aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack <66967891+ASpoonPlaysGames@users.noreply.github.com>2023-10-11 21:57:00 +0100
committerGitHub <noreply@github.com>2023-10-11 22:57:00 +0200
commit3714f23edde5a48aa29560dc74fc5a59ce2ca85a (patch)
treed9e268fc0f005420265d71ba694a8ee1dcf78376
parentadd7305318b6fc1fe74389c60c352a19bddd7748 (diff)
downloadNorthstarMods-3714f23edde5a48aa29560dc74fc5a59ce2ca85a.tar.gz
NorthstarMods-3714f23edde5a48aa29560dc74fc5a59ce2ca85a.zip
Fix `StringReplace` looping forever when replacing character when replacing same character as match (#736)
Find the next replacement starting from the end of the last one, instead of from the start of the string
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/sh_utility_all.gnut2
1 files changed, 1 insertions, 1 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/sh_utility_all.gnut b/Northstar.CustomServers/mod/scripts/vscripts/sh_utility_all.gnut
index a2de99136..9e7629858 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/sh_utility_all.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/sh_utility_all.gnut
@@ -362,7 +362,7 @@ string function StringReplace( string baseString, string searchString, string re
source = part1 + replaceString + part2
loopedOnce = true
- findResult = source.find( searchString )
+ findResult = source.find( searchString, findResult + replaceString.len() )
}
return baseString