summaryrefslogtreecommitdiff
path: root/modules/mono
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2023-03-30 21:36:24 +0200
committerGitHub <noreply@github.com>2023-03-30 21:36:24 +0200
commitb8b29c856605c8d1f41df5b71279955dd764bb3f (patch)
tree1b8f65ae0f2cd380641097ffbb82333bb8638da9 /modules/mono
parent19501f8eb19481b029f67ecf78e711d42f2fc431 (diff)
parent4323c8b78ba03c8fef6dfc580c1aa1010ed3096d (diff)
Merge pull request #75500 from YuriSizov/4.0-cherrypicks
Cherry-picks for the 4.0 branch (future 4.0.2) - 2nd batch
Diffstat (limited to 'modules/mono')
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs6
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs
index 8598c32760..5163ea5113 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs
@@ -554,6 +554,7 @@ namespace Godot.Collections
// instead of growing it as we add items.
if (collection.TryGetNonEnumeratedCount(out int count))
{
+ int oldCount = Count;
Resize(Count + count);
using var enumerator = collection.GetEnumerator();
@@ -561,7 +562,7 @@ namespace Godot.Collections
for (int i = 0; i < count; i++)
{
enumerator.MoveNext();
- this[count + i] = Variant.From(enumerator.Current);
+ this[oldCount + i] = Variant.From(enumerator.Current);
}
return;
@@ -1578,6 +1579,7 @@ namespace Godot.Collections
// instead of growing it as we add items.
if (collection.TryGetNonEnumeratedCount(out int count))
{
+ int oldCount = Count;
Resize(Count + count);
using var enumerator = collection.GetEnumerator();
@@ -1585,7 +1587,7 @@ namespace Godot.Collections
for (int i = 0; i < count; i++)
{
enumerator.MoveNext();
- this[count + i] = enumerator.Current;
+ this[oldCount + i] = enumerator.Current;
}
return;