Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEgor Bogatov <egorbo@gmail.com>2018-06-15 05:17:27 +0300
committerAlexander Köplinger <alex.koeplinger@outlook.com>2018-06-15 05:17:27 +0300
commitab816c3efdb1aedb4baa1b8d2fec8ee2f8e15683 (patch)
tree6df223eee572b4375dd2136c25f4395a09e82064
parentca8bc154a3ed46de33b136c3ad61932519c7511f (diff)
cherry-pick Fix number formatting exception with empty NumberGroupSizes array (#81)
Cherry-pick https://github.com/dotnet/coreclr/pull/18221 For https://github.com/mono/mono/pull/8626#discussion_r194984329
-rw-r--r--src/Common/src/CoreLib/System/Number.Formatting.cs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Common/src/CoreLib/System/Number.Formatting.cs b/src/Common/src/CoreLib/System/Number.Formatting.cs
index 2eb47c026f..f3cacf4faf 100644
--- a/src/Common/src/CoreLib/System/Number.Formatting.cs
+++ b/src/Common/src/CoreLib/System/Number.Formatting.cs
@@ -1974,14 +1974,15 @@ namespace System
{
if (groupDigits != null)
{
- int groupSizeIndex = 0; // Index into the groupDigits array.
- int groupSizeCount = groupDigits[groupSizeIndex]; // The current total of group size.
+ int groupSizeIndex = 0; // Index into the groupDigits array.
int bufferSize = digPos; // The length of the result buffer string.
int groupSize = 0; // The current group size.
// Find out the size of the string buffer for the result.
if (groupDigits.Length != 0) // You can pass in 0 length arrays
{
+ int groupSizeCount = groupDigits[groupSizeIndex]; // The current total of group size.
+
while (digPos > groupSizeCount)
{
groupSize = groupDigits[groupSizeIndex];