From b7bc0cae539617af4dfac5b44b0ebd700efe2084 Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 4 Jun 2002 07:34:19 +0000 Subject: * string.c (rb_str_aset): should raise error if an indexing string is not found in the receiver. * sprintf.c (rb_f_sprintf): "%d" should convert objects into integers using Integer(). * lib/tempfile.rb (Tempfile::size): added. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'string.c') diff --git a/string.c b/string.c index f3c3097637..8abce208bf 100644 --- a/string.c +++ b/string.c @@ -1307,9 +1307,10 @@ rb_str_aset(str, indx, val) case T_STRING: beg = rb_str_index(str, indx, 0); - if (beg != -1) { - rb_str_update(str, beg, RSTRING(indx)->len, val); + if (beg < 0) { + rb_raise(rb_eIndexError, "string not matched"); } + rb_str_update(str, beg, RSTRING(indx)->len, val); return val; default: -- cgit v1.2.3