Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 9c6b90e

Browse files
authored
Fix number formatting exception with empty NumberGroupSizes array (#18221) (#18667)
1 parent 1cebf4d commit 9c6b90e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/mscorlib/shared/System/Number.Formatting.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1974,13 +1974,14 @@ private static unsafe void FormatFixed(ref ValueStringBuilder sb, ref NumberBuff
19741974
if (groupDigits != null)
19751975
{
19761976
int groupSizeIndex = 0; // Index into the groupDigits array.
1977-
int groupSizeCount = groupDigits[groupSizeIndex]; // The current total of group size.
19781977
int bufferSize = digPos; // The length of the result buffer string.
19791978
int groupSize = 0; // The current group size.
19801979

19811980
// Find out the size of the string buffer for the result.
19821981
if (groupDigits.Length != 0) // You can pass in 0 length arrays
19831982
{
1983+
int groupSizeCount = groupDigits[groupSizeIndex]; // The current total of group size.
1984+
19841985
while (digPos > groupSizeCount)
19851986
{
19861987
groupSize = groupDigits[groupSizeIndex];

0 commit comments

Comments
 (0)