From 69bc004e089afd0179b9e5428731d1c1ece8c452 Mon Sep 17 00:00:00 2001 From: cremno Date: Sat, 15 Feb 2014 15:47:11 +0100 Subject: iv_size (non-seglist): return 0 if t is NULL --- src/variable.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/variable.c b/src/variable.c index 3dc562a5e..957383ad2 100644 --- a/src/variable.c +++ b/src/variable.c @@ -369,10 +369,12 @@ iv_foreach(mrb_state *mrb, iv_tbl *t, iv_foreach_func *func, void *p) static size_t iv_size(mrb_state *mrb, iv_tbl *t) { - khash_t(iv) *h = &t->h; + khash_t(iv) *h; - if (!h) return 0; - return kh_size(h); + if (t && (h = &t->h)) { + return kh_size(h); + } + return 0; } static iv_tbl* -- cgit v1.2.3