Fix adding content to the content map if it is empty

This commit is contained in:
Campbell 2024-07-27 19:36:27 -04:00
parent 817a2c9ac5
commit 76b773ee36
Signed by: NinjaCheetah
GPG Key ID: B547958AF96ED344

View File

@ -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, # 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. # for not just storing these as integers like you did EVERYWHERE else.
maximum_index = int(self.shared_records[-1].shared_id, 16) try:
new_index = f"{maximum_index + 1:08X}" 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)) self.shared_records.append(_SharedContentRecord(new_index, content_hash_converted))
return new_index return new_index