Skip to content

Commit

Permalink
DYN-6836 Arrange call crash guard (#15319)
Browse files Browse the repository at this point in the history
  • Loading branch information
QilongTang authored Jun 17, 2024
1 parent f1831f6 commit bfb74ab
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/DynamoCoreWpf/UI/InOutPortPanel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
Expand Down Expand Up @@ -26,14 +26,21 @@ protected override Size ArrangeOverride(Size arrangeSize)
double x = 0, y = 0;
foreach (UIElement child in this.Children)
{
var portVm = generator.ItemFromContainer(child) as PortViewModel;
var lineIndex = portVm.PortModel.LineIndex;
var multiplier = ((lineIndex == -1) ? itemIndex : lineIndex);
var portHeight = portVm.PortModel.Height;
try
{
var portVm = generator.ItemFromContainer(child) as PortViewModel;
var lineIndex = portVm.PortModel.LineIndex;
var multiplier = ((lineIndex == -1) ? itemIndex : lineIndex);
var portHeight = portVm.PortModel.Height;

y = multiplier * portHeight;
child.Arrange(new Rect(x, y, arrangeSize.Width, portHeight));
itemIndex = itemIndex + 1;
y = multiplier * portHeight;
child.Arrange(new Rect(x, y, arrangeSize.Width, portHeight));
itemIndex = itemIndex + 1;
}
catch (Exception ex)
{
Analytics.TrackException(ex, true);
}
}

return base.ArrangeOverride(arrangeSize);
Expand Down

0 comments on commit bfb74ab

Please sign in to comment.