Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Aragas committed Apr 25, 2024
1 parent 85330dc commit 41400bc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ partial class LauncherManagerHandler
protected static IEnumerable<ModuleInfoExtended> GetLauncherFeatures() =>
FeatureIds.LauncherFeatures.Select(x => new ModuleInfoExtended { Id = x, IsSingleplayerModule = true });

private List<ModuleInfoExtendedWithMetadata> _modules;
private List<ModuleInfoExtendedWithMetadata>? _modules;
private List<ModuleInfoExtendedWithMetadata>? _allModules;

/// <summary>
Expand All @@ -31,7 +31,7 @@ protected static IEnumerable<ModuleInfoExtended> GetLauncherFeatures() =>
/// </summary>
protected internal IReadOnlyList<ModuleInfoExtendedWithMetadata> GetModules()
{
if (_allModules is null)
if (_allModules is null || _modules is null)
{
_allModules = ReloadModules().ToList();
_modules = _allModules.GroupBy(x => x.Id).Select(x => x.First()).ToList();
Expand All @@ -45,7 +45,7 @@ protected internal IReadOnlyList<ModuleInfoExtendedWithMetadata> GetModules()
/// </summary>
protected internal IReadOnlyList<ModuleInfoExtendedWithMetadata> GetAllModules()
{
if (_allModules is null)
if (_allModules is null || _modules is null)
{
_allModules = ReloadModules().ToList();
_modules = _allModules.GroupBy(x => x.Id).Select(x => x.First()).ToList();
Expand Down
2 changes: 1 addition & 1 deletion src/Bannerlord.LauncherManager/LauncherManagerHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public LauncherManagerHandler(ILauncherStateProvider launcherStateProvider, IGam
/// </summary>
public void RefreshModules()
{
_modules.Clear();
_modules = null;
_allModules = null;
ExtendedModuleInfoCache = GetLauncherFeatures().Concat(GetModules()).ToDictionary(x => x.Id, x => x);
}
Expand Down

0 comments on commit 41400bc

Please sign in to comment.