From 7863497ac8ab66cbb23146a079af61a29efd0653 Mon Sep 17 00:00:00 2001 From: Chaitanya Rahalkar Date: Sun, 24 Mar 2024 12:08:44 -0500 Subject: [PATCH] Fix empty message array error when running on Windows --- software/source/server/utils/kernel.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/software/source/server/utils/kernel.py b/software/source/server/utils/kernel.py index b443bbaf..e8ac7fb1 100644 --- a/software/source/server/utils/kernel.py +++ b/software/source/server/utils/kernel.py @@ -45,15 +45,16 @@ def custom_filter(message): def check_filtered_kernel(): messages = get_kernel_messages() - messages.replace(last_messages, "") - messages = messages.split("\n") - - filtered_messages = [] - for message in messages: - if custom_filter(message): - filtered_messages.append(message) - - return "\n".join(filtered_messages) + if messages: + messages.replace(last_messages, "") + messages = messages.split("\n") + + filtered_messages = [] + for message in messages: + if custom_filter(message): + filtered_messages.append(message) + + return "\n".join(filtered_messages) async def put_kernel_messages_into_queue(queue): while True: