From 0954975374bbc1c8f387dda4eed28509112db537 Mon Sep 17 00:00:00 2001 From: Trysdyn Black Date: Sun, 6 Oct 2024 16:41:16 -0700 Subject: [PATCH] Fix crash if BCCE log lacks a COMMANDS section --- main.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index dc459f0..4b92d47 100644 --- a/main.py +++ b/main.py @@ -266,11 +266,14 @@ if __name__ == "__main__": # Subkey CHARACTERS commands with COMMANDS data # This turns lists of commands each character has into hashes where # Command name => Textual desc of command - for character, c_data in data["CHARACTERS"].items(): - new_commands = {} - for command in c_data["commands"]: - new_commands[command] = data["COMMANDS"].get(command, command) - c_data["commands"] = new_commands + # Certain flags don't shuffle commands like this so we have to check + if "COMMANDS" in data: + for character, c_data in data["CHARACTERS"].items(): + new_commands = {} + + for command in c_data["commands"]: + new_commands[command] = data["COMMANDS"].get(command, command) + c_data["commands"] = new_commands # If we have a STATS block, snap it into CHARACTER data # BCCE broke this out into its own section