From 1a703300805d52c04c352c0c085d0511e3ca46af Mon Sep 17 00:00:00 2001 From: gsd Date: Sat, 11 Mar 2023 11:31:31 +0300 Subject: [PATCH] KPACUBO --- ext/python-a2s-rcon-api/service.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/ext/python-a2s-rcon-api/service.py b/ext/python-a2s-rcon-api/service.py index ba52efe..c41c136 100644 --- a/ext/python-a2s-rcon-api/service.py +++ b/ext/python-a2s-rcon-api/service.py @@ -94,12 +94,16 @@ class SourceBackend: if(request.password == None): return Response(status_code = 403) - status_lines:str = await VALVE_SERVER_RCON( - "status", - host = request.address, - port = request.port, - passwd = request.password - ) + try: + status_lines:str = await VALVE_SERVER_RCON( + "status", + host = request.address, + port = request.port, + passwd = request.password + ) + except UnicodeDecodeError as err: + print(f"Cannot execute 'status' on {request.address}:{request.port}, error: {err}") + return Response(status_code = 500) try: start_index = status_lines.index("# userid")