summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/string.c b/string.c
index a273400d89..02abb90b07 100644
--- a/string.c
+++ b/string.c
@@ -2092,6 +2092,7 @@ rb_str_capitalize_bang(str)
int modify = 0;
rb_str_modify(str);
+ if (RSTRING(str)->len == 0 || !RSTRING(str)->ptr) return Qnil;
s = RSTRING(str)->ptr; send = s + RSTRING(str)->len;
if (ISLOWER(*s)) {
*s = toupper(*s);