Skip to content

Commit

Permalink
fix possible IndexOutOfRangeException on FabricVersionLoader.cs, Quil…
Browse files Browse the repository at this point in the history
…tVersionLoader.cs
  • Loading branch information
AlphaBs committed Apr 26, 2022
1 parent 8401241 commit bd0a949
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions CmlLib/Core/Installer/FabricMC/FabricVersionLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ private async Task<MVersionCollection> internalGetVersionMetadatasAsync(bool syn
else
loaders = await GetFabricLoadersAsync().ConfigureAwait(false);

LoaderVersion = loaders[0].Version;
if (loaders.Length == 0 || string.IsNullOrEmpty(LoaderVersion))
if (loaders.Length == 0 || string.IsNullOrEmpty(loaders[0].Version))
throw new KeyNotFoundException("can't find loaders");

LoaderVersion = loaders[0].Version;
}

string url = "https://meta.fabricmc.net/v2/versions/game/intermediary";
Expand Down
5 changes: 3 additions & 2 deletions CmlLib/Core/Installer/QuiltMC/QuiltVersionLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ private async Task<MVersionCollection> internalGetVersionMetadatasAsync(bool syn
else
loaders = await GetQuiltLoadersAsync().ConfigureAwait(false);

LoaderVersion = loaders[0].Version;
if (loaders.Length == 0 || string.IsNullOrEmpty(LoaderVersion))
if (loaders.Length == 0 || string.IsNullOrEmpty(loaders[0].Version))
throw new KeyNotFoundException("can't find loaders");

LoaderVersion = loaders[0].Version;
}

string url = "https://meta.quiltmc.org/v3/versions/game";
Expand Down

0 comments on commit bd0a949

Please sign in to comment.