[smuxi/stable: 2/2] Engine: guard MessageBuilder.NormalizeNewlines()
- From: Mirco M. M. Bauer <mmmbauer src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [smuxi/stable: 2/2] Engine: guard MessageBuilder.NormalizeNewlines()
- Date: Tue, 3 Nov 2015 17:27:38 +0000 (UTC)
commit 0baf630cae551d044fc11b37a70c2c4aaae0cbcd
Author: Mirco Bauer <meebey meebey net>
Date: Tue Nov 3 18:22:19 2015 +0100
Engine: guard MessageBuilder.NormalizeNewlines()
If "text" only contains \n it will throw an ArgumentOutOfRangeException.
src/Engine/Messages/MessageBuilder.cs | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/Engine/Messages/MessageBuilder.cs b/src/Engine/Messages/MessageBuilder.cs
index 7e6851d..6ff9713 100644
--- a/src/Engine/Messages/MessageBuilder.cs
+++ b/src/Engine/Messages/MessageBuilder.cs
@@ -807,7 +807,9 @@ namespace Smuxi.Engine
normalized.AppendFormat("{0} ", trimmed);
}
// remove trailing space
- normalized.Length--;
+ if (normalized.Length > 0) {
+ normalized.Length--;
+ }
return normalized.ToString();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]