From 76afcefd528c46bfc2a482b5a56aa588e8704a11 Mon Sep 17 00:00:00 2001 From: defanor Date: Sat, 8 Jan 2022 01:30:31 +0300 Subject: dwproxy.py: handle a KeyError in case if there's no room identifier --- dwproxy.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dwproxy.py b/dwproxy.py index 99bd15d..f7943a0 100755 --- a/dwproxy.py +++ b/dwproxy.py @@ -80,13 +80,14 @@ class TelnetHandler(socketserver.BaseRequestHandler): def process_cmd(self, s): """Processes client commands.""" - # Return at once if we don't have room information - if not self.gmcp_data['room.info']['identifier']: + try: + cur_room_id = self.gmcp_data['room.info']['identifier'] + except KeyError: + # Return if we don't have room information return False cur = self.server.dbcur - cur_room_id = self.gmcp_data['room.info']['identifier'] origin_room = cur_room_id sw_match = sw_cmd.match(s) -- cgit v1.2.3