From 281923a4630d5143826b4a1531c52f2f914b0d33 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sat, 8 Dec 2018 08:56:47 +0000 Subject: [PATCH] Check whether we actually have a httpd running when unloading rest_api.py --- modules/rest_api.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/rest_api.py b/modules/rest_api.py index ecba53f3..f558efca 100644 --- a/modules/rest_api.py +++ b/modules/rest_api.py @@ -92,6 +92,7 @@ class Module(ModuleManager.BaseModule): global _log _log = self.log + self.httpd = None if self.bot.get_setting("rest-api", False): self.httpd = http.server.HTTPServer(("", 5000), Handler) self.httpd.socket = ssl.wrap_socket(self.httpd.socket, @@ -103,7 +104,8 @@ class Module(ModuleManager.BaseModule): self.thread.start() def unload(self): - self.httpd.shutdown() + if self.httpd: + self.httpd.shutdown() @utils.hook("received.command.apikey", private_only=True) def api_key(self, event):