summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/BString.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/BString.cc b/src/BString.cc
index 74bc7d9..bf7b4e3 100644
--- a/src/BString.cc
+++ b/src/BString.cc
@@ -53,6 +53,9 @@ Balau::String & Balau::String::do_rtrim() {
unsigned int i, l = length(), p = l;
const char * buffer = data();
+ if (l == 0)
+ return *this;
+
for (i = l - 1; i > 0; i--)
if (isspace(buffer[i]))
p--;