In #77 we saw a save file that repeats keys unexpectedly, leading to _extract_country_economy crashing when it got a list while expecting a float. This adds type checking, and if the first element of the list is a valid float or int, uses that instead; else uses 0.0.
Also refactors a bit to avoid repeatedly checking if the constant 0.0 is a list.
Example new log output:
MainProcess - 2022-11-25 12:06:34,107 - stellarisdashboard.parsing.timeline - WARNING - test_9673941 2208.07.07 country_power_projection: Found unexpected type list with value [0.24488, 0.24488].
MainProcess - 2022-11-25 12:06:34,112 - stellarisdashboard.parsing.timeline - WARNING - test_9673941 2208.07.07 country_ethic: Found unexpected type list with value [0.5, 0.5].
And confirmation it successfully uses the first element (0.24 is what matches the first log line above, ingame):
In #77 we saw a save file that repeats keys unexpectedly, leading to
_extract_country_economy
crashing when it got a list while expecting a float. This adds type checking, and if the first element of the list is a valid float or int, uses that instead; else uses 0.0.Also refactors a bit to avoid repeatedly checking if the constant 0.0 is a list.
Example new log output:
And confirmation it successfully uses the first element (0.24 is what matches the first log line above, ingame):