Skip to content

Commit 1ddf162

Browse files
committed
Fix crash on non-sophon games
1 parent b10a954 commit 1ddf162

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

CollapseLauncher/Classes/Helper/LauncherApiLoader/LauncherApiBase.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -218,20 +218,24 @@ protected virtual async Task LoadLauncherGameResourceSophon(ActionOnTimeOutRetry
218218
{
219219
EnsurePresetConfigNotNull();
220220

221-
SophonChunkUrls? sophonUrls = PresetConfig?.LauncherResourceChunksURL;
222-
string? sophonBranchUrl = sophonUrls?.BranchUrl;
221+
SophonChunkUrls? sophonUrls = PresetConfig?.LauncherResourceChunksURL;
222+
if (sophonUrls == null)
223+
{
224+
return;
225+
}
223226

227+
string? sophonBranchUrl = sophonUrls.BranchUrl;
224228
if (string.IsNullOrEmpty(PresetConfig!.LauncherBizName) || string.IsNullOrEmpty(sophonBranchUrl))
225229
{
226230
Logger.LogWriteLine("This game/region doesn't have Sophon->BranchUrl or PresetConfig->LauncherBizName property defined! This might cause the launcher inaccurately check the version if Zip download is unavailable", LogType.Warning, true);
227231
}
228232

229-
await (sophonUrls?.EnsureReassociated(ApiGeneralHttpClient,
230-
sophonBranchUrl,
231-
PresetConfig.LauncherBizName!,
232-
false,
233-
token) ?? Task.CompletedTask);
234-
sophonUrls?.ResetAssociation(); // Reset association so it won't conflict with preload/update/install activity
233+
await sophonUrls.EnsureReassociated(ApiGeneralHttpClient,
234+
sophonBranchUrl,
235+
PresetConfig.LauncherBizName!,
236+
false,
237+
token);
238+
sophonUrls.ResetAssociation(); // Reset association so it won't conflict with preload/update/install activity
235239

236240
ActionTimeoutTaskAwaitableCallback<HoYoPlayLauncherGameInfo?> launcherSophonBranchCallback =
237241
innerToken =>

0 commit comments

Comments
 (0)