Skip to content

Commit 52ea2bf

Browse files
committed
Update FutureListener.cs
1 parent 4c9c213 commit 52ea2bf

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

Assets/_PackageRoot/Tests/Editor/Utils/FutureListener.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,16 @@ public FutureListener(IFuture<T> future, bool ignoreLoadingWhenLoaded = false, D
7373
lock (events)
7474
events.Add(new EventData { name = EventName.Failed, value = exception });
7575
});
76-
future.Canceled(() =>
76+
if (future.Status != FutureStatus.Disposed && !future.IsCompleted)
7777
{
78-
if (logLevel.Value.IsActive(DebugLevel.Trace))
79-
Debug.Log($"[FutureListener] Future[id={future.Id}] Canceled");
80-
lock (events)
81-
events.Add(new EventData { name = EventName.Canceled });
82-
});
78+
future.Canceled(() =>
79+
{
80+
if (logLevel.Value.IsActive(DebugLevel.Trace))
81+
Debug.Log($"[FutureListener] Future[id={future.Id}] Canceled");
82+
lock (events)
83+
events.Add(new EventData { name = EventName.Canceled });
84+
});
85+
}
8386
future.Completed(value =>
8487
{
8588
if (logLevel.Value.IsActive(DebugLevel.Trace))

0 commit comments

Comments
 (0)