Skip to content

Commit

Permalink
Merge pull request #29695 from peppy/fail-t-request-on-null-response
Browse files Browse the repository at this point in the history
Trigger request failure on receiving a null response for a typed `APIRequest`
  • Loading branch information
peppy authored Sep 5, 2024
2 parents 3a3a912 + 6fc6090 commit c51503c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions osu.Game/Online/API/APIRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ protected override void PostProcess()
Response = ((OsuJsonWebRequest<T>)WebRequest).ResponseObject;
Logger.Log($"{GetType().ReadableName()} finished with response size of {WebRequest.ResponseStream.Length:#,0} bytes", LoggingTarget.Network);
}

if (Response == null)
TriggerFailure(new ArgumentNullException(nameof(Response)));
}

internal void TriggerSuccess(T result)
Expand Down Expand Up @@ -152,6 +155,8 @@ public void Perform()

PostProcess();

if (isFailing) return;

TriggerSuccess();
}

Expand Down

0 comments on commit c51503c

Please sign in to comment.