summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/String.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/String.cc b/lib/String.cc
index 6fc9bfa..08818eb 100644
--- a/lib/String.cc
+++ b/lib/String.cc
@@ -237,6 +237,9 @@ const char * String::to_charp(size_t from, ssize_t to) const throw (GeneralExcep
if (to < 0) {
return str + from;
} else {
+ if (siz == 0) {
+ return str;
+ }
if (((size_t) to) >= siz) {
to = siz - 1;
}