From 893979b3deab4b95cc62814c18ba2db2fa3a9d87 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 Nov 2020 13:10:18 +0900 Subject: [PATCH] Add exception if attempting to exceed the maximum supported lookup size for one request --- osu.Game/Online/API/Requests/GetUsersRequest.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game/Online/API/Requests/GetUsersRequest.cs b/osu.Game/Online/API/Requests/GetUsersRequest.cs index 9a7006f5d6..0ec5173fb6 100644 --- a/osu.Game/Online/API/Requests/GetUsersRequest.cs +++ b/osu.Game/Online/API/Requests/GetUsersRequest.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Linq; namespace osu.Game.Online.API.Requests @@ -9,8 +10,13 @@ namespace osu.Game.Online.API.Requests { private readonly int[] userIds; + private const int max_ids_per_request = 50; + public GetUsersRequest(int[] userIds) { + if (userIds.Length > max_ids_per_request) + throw new ArgumentException($"{nameof(GetUsersRequest)} calls only support up to {max_ids_per_request} IDs at once"); + this.userIds = userIds; }