summaryrefslogtreecommitdiff
path: root/marshal.c
diff options
context:
space:
mode:
Diffstat (limited to 'marshal.c')
-rw-r--r--marshal.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/marshal.c b/marshal.c
index fdfa9868c5..c6b2d19838 100644
--- a/marshal.c
+++ b/marshal.c
@@ -1086,7 +1086,9 @@ r_ivar(VALUE obj, struct load_arg *arg)
int idx = rb_enc_find_index(StringValueCStr(val));
if (idx > 0) rb_enc_associate_index(obj, idx);
}
- rb_ivar_set(obj, id, val);
+ else {
+ rb_ivar_set(obj, id, val);
+ }
}
}
}