summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2022-01-08 01:30:31 +0300
committerdefanor <defanor@uberspace.net>2022-01-08 01:30:31 +0300
commit76afcefd528c46bfc2a482b5a56aa588e8704a11 (patch)
tree4569c877d22aa7bc54a9093bb964c7d4dc243f97
parent16555c6cf9b6fa8f4348f6620c0b090e959d36f0 (diff)
dwproxy.py: handle a KeyError in case if there's no room identifier
-rwxr-xr-xdwproxy.py7
1 files 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)