Skip to content

Commit

Permalink
Added additional check in UpdateRowColDefinitions to prevent crash in…
Browse files Browse the repository at this point in the history
… certain conditions.
  • Loading branch information
bdachev committed Aug 24, 2020
1 parent ca21eca commit c382a88
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions source/Components/AvalonDock/Controls/LayoutGridControl.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/************************************************************************
/************************************************************************
AvalonDock
Copyright (C) 2007-2013 Xceed Software Inc.
Expand Down Expand Up @@ -209,7 +209,8 @@ private void UpdateRowColDefinitions()
{
var iColumn = 0;
var iChild = 0;
for (var iChildModel = 0; iChildModel < _model.Children.Count; iChildModel++, iColumn++, iChild++)
// BD: 24.08.2020 added check for iChild against InternalChildren.Count
for (var iChildModel = 0; iChildModel < _model.Children.Count && iChild < InternalChildren.Count; iChildModel++, iColumn++, iChild++)
{
var childModel = _model.Children[iChildModel] as ILayoutPositionableElement;
ColumnDefinitions.Add(new ColumnDefinition
Expand Down Expand Up @@ -244,7 +245,8 @@ private void UpdateRowColDefinitions()
{
var iRow = 0;
var iChild = 0;
for (var iChildModel = 0; iChildModel < _model.Children.Count; iChildModel++, iRow++, iChild++)
// BD: 24.08.2020 added check for iChild against InternalChildren.Count
for (var iChildModel = 0; iChildModel < _model.Children.Count && iChild < InternalChildren.Count; iChildModel++, iRow++, iChild++)
{
var childModel = _model.Children[iChildModel] as ILayoutPositionableElement;
RowDefinitions.Add(new RowDefinition
Expand Down

0 comments on commit c382a88

Please sign in to comment.