From a776aab89798149d48c4c9b7f62208bc9de2c627 Mon Sep 17 00:00:00 2001 From: James Lu Date: Sat, 18 Feb 2017 12:45:43 -0800 Subject: [PATCH] utils: ignore missing services in unregisterService instead of raising an error This is a prerequisite for the next commit (service spawn toggle options). (#403) --- utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/utils.py b/utils.py index 35e7be7..875832d 100644 --- a/utils.py +++ b/utils.py @@ -493,8 +493,12 @@ def registerService(name, *args, **kwargs): def unregisterService(name): """Unregisters an existing service bot.""" - assert name in world.services, "Unknown service %s" % name name = name.lower() + + if name not in world.services: + # Service bot doesn't exist; ignore. + return + sbot = world.services[name] for ircnet, uid in sbot.uids.items(): ircobj = world.networkobjects[ircnet]