Skip to content

Commit 45d5548

Browse files
committed
Allow Genshin Repair if no dispatch token is available
1 parent 1b19c1a commit 45d5548

File tree

1 file changed

+15
-3
lines changed
  • CollapseLauncher/Classes/RepairManagement/Genshin

1 file changed

+15
-3
lines changed

CollapseLauncher/Classes/RepairManagement/Genshin/Repair.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// ReSharper disable StringLiteralTypo
2121
// ReSharper disable CommentTypo
2222

23+
#nullable enable
2324
namespace CollapseLauncher
2425
{
2526
internal partial class GenshinRepair
@@ -45,7 +46,15 @@ private async Task<bool> Repair(List<PkgVersionProperties> repairAssetIndex, Can
4546
DownloadClient downloadClient = DownloadClient.CreateInstance(client);
4647

4748
// Get the Dispatcher Query
48-
QueryProperty queryProperty = await GetCachedDispatcherQuery(downloadClient.GetHttpClient(), token);
49+
QueryProperty? queryProperty = null;
50+
try
51+
{
52+
queryProperty = await GetCachedDispatcherQuery(downloadClient.GetHttpClient(), token);
53+
}
54+
catch (Exception ex)
55+
{
56+
LogWriteLine($"An error has occurred while parsing Persistent Manifests! {ex}", LogType.Warning, true);
57+
}
4958

5059
// Iterate repair asset
5160
ObservableCollection<IAssetProperty> assetProperty = [.. AssetEntry];
@@ -96,7 +105,10 @@ await Parallel.ForEachAsync(
96105
}
97106
}
98107

99-
await SavePersistentRevision(queryProperty, token);
108+
if (queryProperty != null)
109+
{
110+
await SavePersistentRevision(queryProperty, token);
111+
}
100112

101113
// Duplicate ctable.dat to ctable_streaming.dat
102114
string streamingAssetsPath = Path.Combine(GamePath, $"{ExecPrefix}_Data", "StreamingAssets");
@@ -156,7 +168,7 @@ private async Task RepairAssetTypeGeneric((PkgVersionProperties AssetIndex, IAss
156168
if (isUseSophonDownload)
157169
{
158170
ReadOnlySpan<char> splittedPath = asset.AssetIndex.remoteName.TrimStart('\\');
159-
if (!SophonAssetDictRefLookup.TryGetValue(splittedPath, out SophonAsset downloadAsSophon))
171+
if (!SophonAssetDictRefLookup.TryGetValue(splittedPath, out SophonAsset? downloadAsSophon))
160172
{
161173
throw new InvalidOperationException($"Asset {splittedPath} is marked as \"SophonGeneric\" but it wasn't included in the manifest");
162174
}

0 commit comments

Comments
 (0)