From 40e1f38508eb493cf5e8e2b0a1c1fff58f4f9f73 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Sun, 31 May 2020 13:44:34 +0100 Subject: [PATCH] Add additional error handling in user queries --- modules/userinfo.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/userinfo.py b/modules/userinfo.py index b903e80..94a52c4 100644 --- a/modules/userinfo.py +++ b/modules/userinfo.py @@ -149,10 +149,11 @@ def getUserByNick(name, nick): return main.r.hget(mapspace, nick) else: warn("Entry doesn't exist: %s on %s - attempting auxiliary lookup" % (nick, mapspace)) - #return Falsedd + #return False # legacy code below - remove when map is reliable usermatch = main.r.sscan(gnamespace, match=escape(nick)+"!*", count=-1) if usermatch[1] == []: + warn("No matches found for user query: %s on %s" % (nick, name)) return False else: if len(usermatch[1]) == 1: @@ -184,6 +185,8 @@ def renameUser(name, oldnick, olduser, newnick, newuser): def delUserByNick(name, channel, nick): # kick user = getUserByNick(name, nick) + if not user: + return delUser(name, channel, nick, user) def delUserByNetwork(name, nick, user): # quit