From 84980ad203421f48405ebb9cbab3040b2aedebbf Mon Sep 17 00:00:00 2001 From: RogueException Date: Thu, 13 Oct 2016 12:42:08 -0300 Subject: [PATCH] Fixed OOB error generating bucket ids for certain endpoints --- src/Discord.Net.Core/API/DiscordRestApiClient.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Discord.Net.Core/API/DiscordRestApiClient.cs b/src/Discord.Net.Core/API/DiscordRestApiClient.cs index cb05b1896..e487a5cfa 100644 --- a/src/Discord.Net.Core/API/DiscordRestApiClient.cs +++ b/src/Discord.Net.Core/API/DiscordRestApiClient.cs @@ -1142,7 +1142,7 @@ namespace Discord.API builder.Append(format, lastIndex, endIndex - lastIndex); break; } - builder.Append(format, lastIndex, leftIndex); + builder.Append(format, lastIndex, leftIndex - lastIndex); int rightIndex = format.IndexOf("}", leftIndex); int argId = int.Parse(format.Substring(leftIndex + 1, rightIndex - leftIndex - 1)); @@ -1150,7 +1150,7 @@ namespace Discord.API int? mappedId; mappedId = BucketIds.GetIndex(fieldName); - if(!mappedId.HasValue && rightIndex != endIndex && format[rightIndex + 1] == '/') //Ignore the next slash + if(!mappedId.HasValue && rightIndex != endIndex && format.Length > rightIndex + 1 && format[rightIndex + 1] == '/') //Ignore the next slash rightIndex++; if (mappedId.HasValue)