mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 17:37:23 +09:00
Move the null check in the outside.
AddCursor() should not accept the null value.
This commit is contained in:
parent
a5b1f1a688
commit
48047f2e58
@ -16,7 +16,7 @@ namespace osu.Game.Extensions
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static void AddCursor(this WebRequest webRequest, Cursor cursor)
|
public static void AddCursor(this WebRequest webRequest, Cursor cursor)
|
||||||
{
|
{
|
||||||
cursor?.Properties.ForEach(x =>
|
cursor.Properties.ForEach(x =>
|
||||||
{
|
{
|
||||||
webRequest.AddParameter("cursor[" + x.Key + "]", (x.Value as JValue)?.ToString(CultureInfo.InvariantCulture) ?? x.Value.ToString());
|
webRequest.AddParameter("cursor[" + x.Key + "]", (x.Value as JValue)?.ToString(CultureInfo.InvariantCulture) ?? x.Value.ToString());
|
||||||
});
|
});
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using osu.Framework.IO.Network;
|
using osu.Framework.IO.Network;
|
||||||
using osu.Game.Extensions;
|
using osu.Game.Extensions;
|
||||||
|
|
||||||
@ -11,9 +9,9 @@ namespace osu.Game.Online.API.Requests
|
|||||||
public class GetNewsRequest : APIRequest<GetNewsResponse>
|
public class GetNewsRequest : APIRequest<GetNewsResponse>
|
||||||
{
|
{
|
||||||
private readonly int? year;
|
private readonly int? year;
|
||||||
private readonly Cursor cursor;
|
private readonly Cursor? cursor;
|
||||||
|
|
||||||
public GetNewsRequest(int? year = null, Cursor cursor = null)
|
public GetNewsRequest(int? year = null, Cursor? cursor = null)
|
||||||
{
|
{
|
||||||
this.year = year;
|
this.year = year;
|
||||||
this.cursor = cursor;
|
this.cursor = cursor;
|
||||||
@ -22,7 +20,9 @@ namespace osu.Game.Online.API.Requests
|
|||||||
protected override WebRequest CreateWebRequest()
|
protected override WebRequest CreateWebRequest()
|
||||||
{
|
{
|
||||||
var req = base.CreateWebRequest();
|
var req = base.CreateWebRequest();
|
||||||
req.AddCursor(cursor);
|
|
||||||
|
if (cursor != null)
|
||||||
|
req.AddCursor(cursor);
|
||||||
|
|
||||||
if (year.HasValue)
|
if (year.HasValue)
|
||||||
req.AddParameter("year", year.Value.ToString());
|
req.AddParameter("year", year.Value.ToString());
|
||||||
|
@ -112,7 +112,8 @@ namespace osu.Game.Online.API.Requests
|
|||||||
|
|
||||||
req.AddParameter("nsfw", ExplicitContent == SearchExplicit.Show ? "true" : "false");
|
req.AddParameter("nsfw", ExplicitContent == SearchExplicit.Show ? "true" : "false");
|
||||||
|
|
||||||
req.AddCursor(cursor);
|
if (cursor != null)
|
||||||
|
req.AddCursor(cursor);
|
||||||
|
|
||||||
return req;
|
return req;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user