kaiusl/KLPlugins.DynLeaderboards

First time init doesn't create config if game is not ACC, but does throw an error on Simhub start

Closed this issue · 0 comments

The default leaderboard config is generated at the first start of the plugin. At the moment this only seems happens if the selected game is ACC. However starting the plugin (with any game selected) needs to load that config file. So starting the plugin first time when the selected game is not ACC results in an error.

Steps to reproduce

  • Open Simhub and select some other game than ACC
  • Close Simhub
  • Delete PluginsData\KLPlugins\DynLeaderboards\leaderboardConfigs
  • On the next reload of Simhub an error occurs
[2023-04-18 11:52:08,255] ERROR - An error occured while loading plugin settings control for DynLeaderboardsPlugin: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at KLPlugins.DynLeaderboards.Settings.SettingsControl..ctor(DynLeaderboardsPlugin plugin)
   at KLPlugins.DynLeaderboards.DynLeaderboardsPlugin.GetWPFSettingsControl(PluginManager pluginManager)
   at SimHubWPF.MainWindow.<>c__DisplayClass52_0.<LoadPluginsControls>b__0()

Temporary fix

On my machine Simhub itself launches fine even with this error. Solution is to just select ACC, which will reload the plugin and generate the needed config file. Any following launches (with any game selected) work fine.