Skip to content

Commit

Permalink
Fix TypeError when building Bashed Patch
Browse files Browse the repository at this point in the history
Initialize cached_ini_info to None by default, and swap out the try block for a check.
Tuple full of Nones would not cause a TypeError here, but instead down the road leading to a crash.
  • Loading branch information
BGazotti committed Mar 25, 2024
1 parent 9ec8a51 commit 0ad27c4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Mopy/bash/bosh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ def getStringsPaths(self, lang):
# patch BSA (which only exists in SSE) will always load after the interface
# BSA and hence should win all conflicts (including strings).
_bsa_heuristics = list(enumerate((u'main', u'patch', u'interface')))
def _find_string_bsas(self, cached_ini_info=(None, None, None)):
def _find_string_bsas(self, cached_ini_info=None):
"""Return a list of BSAs to get strings files from. Note that this is
*only* meant for strings files. It sorts the list in such a way as to
prioritize files that are likely to contain the strings, instead of
Expand Down Expand Up @@ -3107,9 +3107,9 @@ def get_bsa_lo(self, for_plugins, cached_ini_info=None):
:param cached_ini_info: Can contain the result of calling
get_bsas_from_inis, in which case calling that (fairly expensive)
method will be skipped."""
try:
if cached_ini_info:
available_bsas, bsa_lo, bsa_cause = cached_ini_info
except TypeError: # cached_ini_info is None - fetch it from disk
else: # cached_ini_info is None - fetch it from disk
available_bsas, bsa_lo, bsa_cause = self.get_bsas_from_inis()
# BSAs loaded based on plugin name load in the middle of the pack
for i, p in enumerate(for_plugins):
Expand Down

2 comments on commit 0ad27c4

@BGazotti
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Infernio @Utumno Not sure whether this was a real issue or I just happened to be unlucky but here we go

@Utumno
Copy link

@Utumno Utumno commented on 0ad27c4 Mar 26, 2024 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.