summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-03-26 18:26:45 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-03-26 18:26:45 +0000
commit1072ad1c2b1c1f55a3677b74f32635d3551a1aaa (patch)
tree163ac41535e8f78baa237a7707adce57c22fb555 /string.c
parentd82d9923cbf775e795ea0473b6b1e359c920fb09 (diff)
* string.c (rb_str_capitalize_bang): check length before upcase
first character. (ruby-bugs:PR#697) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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);