From 249fef7dc49ee5c22256aa7e9c36cd788e0ba323 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Fri, 12 Oct 2018 08:30:57 +0900 Subject: Add `NULL` check in `sg_compact()`; fix #4139 --- src/hash.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/hash.c') diff --git a/src/hash.c b/src/hash.c index 5bccb3091..325c7e66f 100644 --- a/src/hash.c +++ b/src/hash.c @@ -226,12 +226,14 @@ sg_index(mrb_state *mrb, seglist *t) static void sg_compact(mrb_state *mrb, seglist *t) { - segment *seg = t->rootseg; + segment *seg; mrb_int i; segment *seg2 = NULL; mrb_int i2; mrb_int size = 0; + if (t == NULL) return; + seg = t->rootseg; if (t->index && (size_t)t->size == t->index->size) { sg_index(mrb, t); return; -- cgit v1.2.3