Skip to content

Commit

Permalink
Fix IndexOf bug in CreateBucketId (#2948)
Browse files Browse the repository at this point in the history
Fix IndexOf bug in CreateBucketId
  • Loading branch information
TineTheUnc committed Jun 30, 2024
1 parent 8afea2c commit ec0ba49
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Discord.Net.Rest/DiscordRestApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2705,14 +2705,14 @@ private static Func<BucketIds, BucketId> CreateBucketId(Expression<Func<string>>
int lastIndex = 0;
while (true)
{
int leftIndex = format.IndexOf("{", lastIndex);
int leftIndex = format.IndexOf('{', lastIndex);
if (leftIndex == -1 || leftIndex > endIndex)
{
builder.Append(format, lastIndex, endIndex - lastIndex);
break;
}
builder.Append(format, lastIndex, leftIndex - lastIndex);
int rightIndex = format.IndexOf("}", leftIndex);
int rightIndex = format.IndexOf('}', leftIndex);

int argId = int.Parse(format.Substring(leftIndex + 1, rightIndex - leftIndex - 1), NumberStyles.None, CultureInfo.InvariantCulture);
string fieldName = GetFieldName(methodArgs[argId + 1]);
Expand Down

0 comments on commit ec0ba49

Please sign in to comment.