From 399a058934480532f56fa2ab8065b8ae0fb0f533 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Thu, 14 May 2020 17:38:35 -0300 Subject: [PATCH] bring over fixes from WrapLayoutState. --- src/Avalonia.Layout/WrapLayoutState.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Avalonia.Layout/WrapLayoutState.cs b/src/Avalonia.Layout/WrapLayoutState.cs index d0e9869d3f..7955ea983c 100644 --- a/src/Avalonia.Layout/WrapLayoutState.cs +++ b/src/Avalonia.Layout/WrapLayoutState.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using Avalonia.Layout; using System; using System.Collections.Generic; using System.Linq; @@ -51,7 +50,7 @@ namespace Avalonia.Layout internal void RemoveFromIndex(int index) { - if (index > _items.Count) + if (index >= _items.Count) { // Item was added/removed but we haven't realized that far yet return; @@ -137,7 +136,7 @@ namespace Avalonia.Layout internal void RecycleElementAt(int index) { - ILayoutable element = _context.GetOrCreateElementAt(index); + var element = _context.GetOrCreateElementAt(index); _context.RecycleElement(element); } }