Skip to content

Commit 2337883

Browse files
committed
handle array length 0 correctly
1 parent 4e8347a commit 2337883

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CopyPasteHelper.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,9 @@ internal static void PasteItems(string copyBufferString, int[] indicesToInsert,
243243
// Split buffer into transmissions and then into transmission blocks
244244
var copiedType = GetCopiedType(copyBufferString);
245245
int indexOffset = 0;
246+
// If the array is empty, make sure we insert at index 0
247+
if(arrayToInsertInto.arraySize == 0)
248+
indexOffset = -1;
246249
foreach (var transmission in copyBufferString.Substring(k_CopyPasteMarker.Length + k_TypeMarker[copiedType].Length)
247250
.Split(new[] {k_EndOfTransmission}, StringSplitOptions.RemoveEmptyEntries))
248251
{

0 commit comments

Comments
 (0)