summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/io.c b/io.c
index ae021f8a4b..0fd059714a 100644
--- a/io.c
+++ b/io.c
@@ -3461,10 +3461,14 @@ static void
opt_i_set(val)
VALUE val;
{
+ if (!RTEST(val)) {
+ if (ruby_inplace_mode) free(ruby_inplace_mode);
+ ruby_inplace_mode = 0;
+ return;
+ }
+ StringValue(val);
if (ruby_inplace_mode) free(ruby_inplace_mode);
ruby_inplace_mode = 0;
- if (!RTEST(val)) return;
- StringValue(val);
ruby_inplace_mode = strdup(RSTRING(val)->ptr);
}