aboutsummaryrefslogtreecommitdiffstats
path: root/array.c
diff options
context:
space:
mode:
Diffstat (limited to 'array.c')
-rw-r--r--array.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/array.c b/array.c
index 0dfa3aef40..f77cfc7401 100644
--- a/array.c
+++ b/array.c
@@ -804,8 +804,9 @@ rb_ary_join(ary, sep)
len += 10;
}
}
- if (!NIL_P(sep) && TYPE(sep) == T_STRING) {
- len += RSTRING(sep)->len * RARRAY(ary)->len - 1;
+ if (!NIL_P(sep)) {
+ StringValue(sep);
+ len += RSTRING(sep)->len * (RARRAY(ary)->len - 1);
}
result = rb_str_buf_new(len);
for (i=0; i<RARRAY(ary)->len; i++) {