summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/zlib/zlib.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index 918bad6b7d..df2a2501b2 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -1074,11 +1074,13 @@ loop:
}
if (err == Z_NEED_DICT) {
VALUE self = (VALUE)z->stream.opaque;
- VALUE dicts = rb_ivar_get(self, id_dictionaries);
- VALUE dict = rb_hash_aref(dicts, rb_uint2inum(z->stream.adler));
- if (!NIL_P(dict)) {
- rb_inflate_set_dictionary(self, dict);
- goto loop;
+ if (self) {
+ VALUE dicts = rb_ivar_get(self, id_dictionaries);
+ VALUE dict = rb_hash_aref(dicts, rb_uint2inum(z->stream.adler));
+ if (!NIL_P(dict)) {
+ rb_inflate_set_dictionary(self, dict);
+ goto loop;
+ }
}
}
raise_zlib_error(err, z->stream.msg);