From 655df9a489cd7f5965d2c9dfc724c89678b2d82c Mon Sep 17 00:00:00 2001 From: Eric-Joker <60310368+Eric-Joker@users.noreply.github.com> Date: Wed, 25 Sep 2024 12:57:26 +0800 Subject: [PATCH] fix ArgumentNullException (#1102) --- src/Starward/Services/Download/InstallGameService.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Starward/Services/Download/InstallGameService.cs b/src/Starward/Services/Download/InstallGameService.cs index db739e782..980d610ac 100644 --- a/src/Starward/Services/Download/InstallGameService.cs +++ b/src/Starward/Services/Download/InstallGameService.cs @@ -625,8 +625,8 @@ public void ClearState() - protected List _taskItems; - public List TaskItems => _taskItems; + protected Task[] _taskItems; + public Task[] TaskItems => _taskItems; @@ -726,14 +726,14 @@ protected void StartTask(InstallGameState state) async Task RunTasksAsync() { _cancellationTokenSource = new CancellationTokenSource(); - var tasks = new Task[Environment.ProcessorCount]; + _taskItems = new Task[Environment.ProcessorCount]; for (int i = 0; i < Environment.ProcessorCount; i++) { - tasks[i] = ExecuteTaskItemAsync(_cancellationTokenSource.Token); + _taskItems[i] = ExecuteTaskItemAsync(_cancellationTokenSource.Token); } try { - await Task.WhenAll(tasks).ConfigureAwait(false); + await Task.WhenAll(_taskItems).ConfigureAwait(false); } finally {