From dfeaa84d462a93070ee63ec87278a30d3105fa8d Mon Sep 17 00:00:00 2001
From: antirez <antirez@gmail.com>
Date: Mon, 28 Oct 2013 11:17:18 +0100
Subject: [PATCH] dictScan(): empty hash table requires special handling.

---
 src/dict.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/dict.c b/src/dict.c
index 814d5f65..72eecae3 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -754,6 +754,8 @@ unsigned long dictScan(dict *d,
     unsigned long s0, s1;
     unsigned long m0, m1;
 
+    if (dictSize(d) == 0) return 0;
+
     if (!dictIsRehashing(d)) {
         t0 = &(d->ht[0]);
         m0 = t0->sizemask;