Skip to content

Commit

Permalink
Merge pull request #190 from bdachev/UpdateRowColDefinitions_crash
Browse files Browse the repository at this point in the history
Added additional check in UpdateRowColDefinitions to avoid exception.
  • Loading branch information
Dirkster99 authored Aug 24, 2020
2 parents d725fe3 + c382a88 commit 30c51a9
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 30c51a9

Please sign in to comment.