summaryrefslogtreecommitdiff
path: root/ext/zlib/zlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/zlib/zlib.c')
-rw-r--r--ext/zlib/zlib.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index 21bcfbcff8..db3b6c8ed6 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -640,7 +640,13 @@ zstream_detach_input(z)
{
VALUE dst;
- dst = NIL_P(z->input) ? rb_str_new(0, 0) : z->input;
+ if (NIL_P(z->input)) {
+ dst = rb_str_new(0, 0);
+ }
+ else {
+ dst = z->input;
+ RBASIC(dst)->klass = rb_cString;
+ }
z->input = Qnil;
RBASIC(dst)->klass = rb_cString;
return dst;