From aacc3149cee63ca4a954a10d4e1b8256662b852a Mon Sep 17 00:00:00 2001 From: James Lu Date: Tue, 6 Sep 2016 18:06:29 -0700 Subject: [PATCH] fantasy: don't error when bots are removed while processing (e.g. on shutdown) --- plugins/fantasy.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/fantasy.py b/plugins/fantasy.py index d3f9c17..c934a1e 100644 --- a/plugins/fantasy.py +++ b/plugins/fantasy.py @@ -22,7 +22,9 @@ def handle_fantasy(irc, source, command, args): # 3) The message starts with one of our fantasy prefixes. # 4) The sender is NOT a PyLink client (this prevents infinite # message loops). - for botname, sbot in world.services.items(): + for botname, sbot in world.services.copy().items(): + if botname not in world.services: # Bot was removed during iteration + continue log.debug('(%s) fantasy: checking bot %s', irc.name, botname) servuid = sbot.uids.get(irc.name) if servuid in irc.channels[channel].users: