diff --git a/modoboa/policyd/utils.py b/modoboa/policyd/utils.py index 848862b71..430e9accb 100644 --- a/modoboa/policyd/utils.py +++ b/modoboa/policyd/utils.py @@ -7,5 +7,8 @@ from . import constants def get_message_counter(key): """Return current counter for given key.""" - rclient = get_redis_connection() - return rclient.hget(constants.REDIS_HASHNAME, key) + rclient = get_redis_connection(hget_return_type=None) + value = rclient.hget(constants.REDIS_HASHNAME, key) + if value is None: + return None + return int(value)