From 90acc9b6cab556ce482a4fc193dcba8db9da1b7e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Jun 2019 13:52:43 +0900 Subject: [PATCH] Avoid calling api request callback after user cancel --- osu.Game/Online/API/APIRequest.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game/Online/API/APIRequest.cs b/osu.Game/Online/API/APIRequest.cs index 96f3b85272..e8eff5a3a9 100644 --- a/osu.Game/Online/API/APIRequest.cs +++ b/osu.Game/Online/API/APIRequest.cs @@ -88,7 +88,12 @@ namespace osu.Game.Online.API if (checkAndScheduleFailure()) return; - API.Schedule(delegate { Success?.Invoke(); }); + API.Schedule(delegate + { + if (cancelled) return; + + Success?.Invoke(); + }); } public void Cancel() => Fail(new OperationCanceledException(@"Request cancelled"));