From 64ebcdcad00b944e72d98061dc5a3a129b8e2fd8 Mon Sep 17 00:00:00 2001 From: Mark Adams Date: Wed, 8 Jan 2025 22:13:39 -0500 Subject: [PATCH] shorten string to pos before concatenating (#3248) --- src/deluge/util/d_string.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/deluge/util/d_string.cpp b/src/deluge/util/d_string.cpp index 002d11745c..33207859a5 100644 --- a/src/deluge/util/d_string.cpp +++ b/src/deluge/util/d_string.cpp @@ -80,9 +80,7 @@ Error String::concatenateAtPos(char const* newChars, int32_t pos, int32_t newCha return set({newChars, static_cast(newCharsLength)}); } - if (newCharsLength == 0) { - return shorten(pos); - } + unique().resize(pos); unique() += newChars;