From 1e18364e5c34f578eaea359e709160d708f79b52 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 14 Feb 2004 01:12:35 +0000 Subject: Fix for bug #896506 (GUI: Invalid read) svn-id: r12864 --- common/str.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/str.cpp b/common/str.cpp index 2a9d728925..7ead1ddf21 100644 --- a/common/str.cpp +++ b/common/str.cpp @@ -172,8 +172,10 @@ void String::clear() { } void String::insertChar(char c, int p) { + // FIXME: This should be an 'assert', not an 'if' ! if (p >= 0 && p <= _len) { - ensureCapacity(++_len, true); + ensureCapacity(_len + 1, true); + _len++; for (int i = _len; i > p; i--) { _str[i] = _str[i-1]; } -- cgit v1.2.3