From 76b773ee36df96e1e0c359b4b5808f9ed558f7dd Mon Sep 17 00:00:00 2001 From: NinjaCheetah <58050615+NinjaCheetah@users.noreply.github.com> Date: Sat, 27 Jul 2024 19:36:27 -0400 Subject: [PATCH] Fix adding content to the content map if it is empty --- src/libWiiPy/title/content.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libWiiPy/title/content.py b/src/libWiiPy/title/content.py index 8f8ad28..424a02d 100644 --- a/src/libWiiPy/title/content.py +++ b/src/libWiiPy/title/content.py @@ -586,7 +586,10 @@ class SharedContentMap: # Generate the file name for the new shared content by incrementing the highest name by 1. Thank you, Nintendo, # for not just storing these as integers like you did EVERYWHERE else. - maximum_index = int(self.shared_records[-1].shared_id, 16) - new_index = f"{maximum_index + 1:08X}" + try: + maximum_index = int(self.shared_records[-1].shared_id, 16) + new_index = f"{maximum_index + 1:08X}" + except IndexError: + new_index = f"{0:08X}" self.shared_records.append(_SharedContentRecord(new_index, content_hash_converted)) return new_index