diff --git a/plugins/edsm.py b/plugins/edsm.py index 5cd974d53..1d9f8cb85 100644 --- a/plugins/edsm.py +++ b/plugins/edsm.py @@ -491,6 +491,20 @@ def credentials(cmdr: str) -> tuple[str, str] | None: edsm_usernames = config.get_list('edsm_usernames') edsm_apikeys = config.get_list('edsm_apikeys') + if not edsm_usernames: # https://github.com/EDCD/EDMarketConnector/issues/2232 + edsm_usernames = ["" for _ in range(len(cmdrs))] + else: # Check for Mismatched Length - fill with null values. + if len(edsm_usernames) < len(cmdrs): + edsm_usernames.extend(["" for _ in range(len(cmdrs) - len(edsm_usernames))]) + config.set('edsm_usernames', edsm_usernames) + + if not edsm_apikeys: + edsm_apikeys = ["" for _ in range(len(cmdrs))] + else: # Check for Mismatched Length - fill with null values. + if len(edsm_apikeys) < len(cmdrs): + edsm_apikeys.extend(["" for _ in range(len(cmdrs) - len(edsm_apikeys))]) + config.set('edsm_apikeys', edsm_apikeys) + if cmdr in cmdrs and len(cmdrs) == len(edsm_usernames) == len(edsm_apikeys): idx = cmdrs.index(cmdr) if idx < len(edsm_usernames) and idx < len(edsm_apikeys):