From 5d9cea9e0e377cf828a35733c34c71347cc5bf50 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 1 Jan 2017 14:38:46 +0100 Subject: [PATCH] - fixed: FString::StripRight's space checking counter was broken and would cause deletion of the last valid character in the string. --- src/zstring.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/zstring.cpp b/src/zstring.cpp index aed599cd6..cef956c90 100644 --- a/src/zstring.cpp +++ b/src/zstring.cpp @@ -696,7 +696,7 @@ void FString::StripRight () { size_t max = Len(), i; if (max == 0) return; - for (i = --max; i-- > 0; ) + for (i = --max; i > 0; i--) { if (!isspace((unsigned char)Chars[i])) break; @@ -728,12 +728,12 @@ void FString::StripRight (const char *charset) { size_t max = Len(), i; if (max == 0) return; - for (i = --max; i-- > 0; ) + for (i = --max; i > 0; i--) { if (!strchr (charset, Chars[i])) break; } - if (i == max) + if (i == max-1) { // Nothing to strip. return; }