From 43d44da4100389e5d3d2079d23ade8605887ef36 Mon Sep 17 00:00:00 2001 From: Stephen Hodgson Date: Fri, 1 Nov 2024 20:40:34 -0400 Subject: [PATCH] com.utilities.async 2.2.1 (#22) - revert null coalescence for topworker, and added try/catch when attempting to complete --- Runtime/Async/CoroutineWrapper.cs | 13 ++++++++++++- package.json | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Runtime/Async/CoroutineWrapper.cs b/Runtime/Async/CoroutineWrapper.cs index faab795..2525efe 100644 --- a/Runtime/Async/CoroutineWrapper.cs +++ b/Runtime/Async/CoroutineWrapper.cs @@ -63,7 +63,18 @@ public IEnumerator Run() if (processStack.Count == 0) { - awaiter.Complete((T)currentWorker); + T result = default; + + try + { + result = (T)(currentWorker ?? topWorker.Current); + } + catch (Exception) + { + // ignored + } + + awaiter.Complete(result ?? default); yield break; } } diff --git a/package.json b/package.json index 3a10550..379c77f 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "Utilities.Async", "description": "A set of utilities to ease the use of async methods in Unity.", "keywords": [], - "version": "2.2.0", + "version": "2.2.1", "unity": "2020.3", "documentationUrl": "https://github.com/RageAgainstThePixel/com.utilities.async#documentation", "changelogUrl": "https://github.com/RageAgainstThePixel/com.utilities.async/releases",