diff options
Diffstat (limited to 'mcs/class/corlib/System.Text/StringBuilder.cs')
-rw-r--r-- | mcs/class/corlib/System.Text/StringBuilder.cs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/mcs/class/corlib/System.Text/StringBuilder.cs b/mcs/class/corlib/System.Text/StringBuilder.cs index 3e7a3580ee5..9fcf317f9e1 100644 --- a/mcs/class/corlib/System.Text/StringBuilder.cs +++ b/mcs/class/corlib/System.Text/StringBuilder.cs @@ -229,15 +229,16 @@ namespace System.Text { // re-ordered to avoid possible integer overflow if (startIndex < 0 || length < 0 || startIndex > _length - length) throw new ArgumentOutOfRangeException(); - + + if (null != _cached_str) + InternalEnsureCapacity (_length); + // Copy everything after the 'removed' part to the start // of the removed part and truncate the sLength if (_length - (startIndex + length) > 0) String.InternalStrcpy (_str, startIndex, _str, startIndex + length, _length - (startIndex + length)); _length -= length; - if (null != _cached_str) - InternalEnsureCapacity (_length); return this; } |