EDSM Preferences Tab Failing to Load on Clean Install
Please complete the following information:
- Version: 5.10.6
- Game Version: 18.04
- OS: Windows 11
- OS Locale: English
Describe the bug After a first install of EDMC on a brand new machine, the EDSM tab in the preferences is failing to load because the core EDSM plugin is throwing an exception.
Note that I have only noticed this while starting to work on my own plugin again on the new machine, so I have run the game a couple of times and set all my controls up. However I have tested that this bug is exhibiting itself with no other plugins installed (I have removed them for testing this bug).
To Reproduce Steps to reproduce the behavior:
- Install EDMC on a new machine with no other plugins
- Run it. Also (I assume) run the game to get a valid
cmdr. - Go to
File→Settings - Observe no EDSM tab
Expected behavior The EDSM tab should show to allow configuration.
Screenshots
Additional context
I see in the logs that this is being caused by len() being called for edsm_usernames before edsm_usernames has a value.
I had a look at the code - In the code block just above the exception:
cmdrs = config.get_list('edsm_cmdrs')
if not cmdrs:
# Migrate from <= 2.25
cmdrs = [cmdr]
config.set('edsm_cmdrs', cmdrs)
edsm_usernames = config.get_list('edsm_usernames')
edsm_apikeys = config.get_list('edsm_apikeys')
Shouldn't the other two lists also be initialised if not cmdrs. e.g. something like:
cmdrs = config.get_list('edsm_cmdrs')
edsm_usernames = config.get_list('edsm_usernames')
edsm_apikeys = config.get_list('edsm_apikeys')
if not cmdrs:
# Migrate from <= 2.25
cmdrs = [cmdr]
edsm_usernames = [""]
edsm_apikeys = [""]
config.set('edsm_cmdrs', cmdrs)
config.set('edsm_usernames ', edsm_usernames )
config.set('edsm_apikeys ', edsm_apikeys )
The reason I haven't put in a PR for the above is that although I believe this would fix the problem for future clean installs, it doesn't recover my current situation - i.e. on my machine edsm_cmdrs is set correctly but the other two lists are not. I don't know whether you consider that important enough to add code to guard against it too?
When in the heck did this bug get introduced???
Bug confirmed, #2233 created to fix. Thanks for reporting!
Erm, well now I'm confused. Launched EDMC today and went to settings (to look at something else) and I see that the EDSM tab is now showing. Checked the logs and the exception is no longer being thrown.
It seems this will be fixed anytime something tries to set an EDSM config set. 2233 seems to have fixed it, so will mark issue as staged for next release. Will include in 5.11.