Fixes #2331, IndexError: string index out of range (#2383)

This commit is contained in:
matatonic 2023-05-30 21:07:40 -04:00 committed by GitHub
parent b984a44f47
commit e5b756ecfe
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 4AEE18F83AFDEB23

View file

@ -346,7 +346,7 @@ class Handler(BaseHTTPRequestHandler):
# can't really truncate the system messages
system_msg = '\n'.join(system_msgs)
if system_msg[-1] != '\n':
if system_msg and system_msg[-1] != '\n':
system_msg = system_msg + '\n'
system_token_count = len(encode(system_msg)[0])