summaryrefslogtreecommitdiff
path: root/transcode.c
diff options
context:
space:
mode:
Diffstat (limited to 'transcode.c')
-rw-r--r--transcode.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/transcode.c b/transcode.c
index 92fd806597..386942689a 100644
--- a/transcode.c
+++ b/transcode.c
@@ -2699,7 +2699,9 @@ str_transcode0(int argc, VALUE *argv, VALUE *self, int ecflags, VALUE ecopts)
if (!NIL_P(ecopts)) {
rep = rb_hash_aref(ecopts, sym_replace);
}
- *self = rb_str_scrub(str, rep);
+ dest = rb_str_scrub(str, rep);
+ if (NIL_P(dest)) dest = str;
+ *self = dest;
return dencidx;
}
return NIL_P(arg2) ? -1 : dencidx;