summaryrefslogtreecommitdiff
path: root/src/System.Private.CoreLib/shared/System/Threading/Tasks/Task.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/System.Private.CoreLib/shared/System/Threading/Tasks/Task.cs')
-rw-r--r--src/System.Private.CoreLib/shared/System/Threading/Tasks/Task.cs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/System.Private.CoreLib/shared/System/Threading/Tasks/Task.cs b/src/System.Private.CoreLib/shared/System/Threading/Tasks/Task.cs
index a8aac04936..2c35214248 100644
--- a/src/System.Private.CoreLib/shared/System/Threading/Tasks/Task.cs
+++ b/src/System.Private.CoreLib/shared/System/Threading/Tasks/Task.cs
@@ -4477,7 +4477,8 @@ namespace System.Threading.Tasks
// Task is completed. Nothing to do here.
if (continuationsLocalRef == s_taskCompletionSentinel) return;
- if (!(continuationsLocalRef is List<object?> continuationsLocalListRef))
+ List<object?>? continuationsLocalListRef = continuationsLocalRef as List<object?>;
+ if (continuationsLocalListRef is null)
{
// This is not a list. If we have a single object (the one we want to remove) we try to replace it with an empty list.
// Note we cannot go back to a null state, since it will mess up the AddTaskContinuation logic.