3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-01-24 03:04:05 +01:00

utils: ignore missing services in unregisterService instead of raising an error

This is a prerequisite for the next commit (service spawn toggle options). (#403)
This commit is contained in:
James Lu 2017-02-18 12:45:43 -08:00
parent a0ed43bf64
commit a776aab897

View File

@ -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]