Skip to content

Commit 6e11bc6

Browse files
Added essential checks to MarginMe method
1 parent 8bfe698 commit 6e11bc6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Runtime/Extensions/NodeExtensions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,13 +533,16 @@ static int FindIndex(VisualElement value, IEnumerable<VisualElement> children)
533533

534534
await Awaiters.EndOfFrame;
535535

536+
if (!value.IsShowing()) return;
537+
536538
VisualElement parent = value.parent;
537539
if (parent is null) return;
538540

539541
float spacing = parent.customStyle.GetItemSpacing();
540542
if (spacing.Invalid()) return;
541543

542544
IEnumerable<VisualElement> children = parent.Children().Where(x => x.resolvedStyle.display == DisplayStyle.Flex);
545+
if (!children.Any()) return;
543546

544547
bool horizontalDirection = parent.resolvedStyle.flexDirection == FlexDirection.Row;
545548
bool fixedSize = parent.resolvedStyle.flexWrap == Wrap.Wrap;

0 commit comments

Comments
 (0)