summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/string.c b/string.c
index 494dc1d90e..c01f2e595b 100644
--- a/string.c
+++ b/string.c
@@ -9345,7 +9345,11 @@ rb_enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl)
const char *e = RSTRING_END(str);
const char *p1 = p;
long mbminlen = rb_enc_mbminlen(enc);
- if (!NIL_P(repl)) {
+ if (rb_block_given_p()) {
+ rep = NULL;
+ replen = 0;
+ }
+ else if (!NIL_P(repl)) {
rep = RSTRING_PTR(repl);
replen = RSTRING_LEN(repl);
}