Merge pull request #1486 from levi/update-asdk

[ASInsetLayoutSpec] Prevent from creating a computed layout when child is nil
This commit is contained in:
appleguy
2016-04-06 21:06:24 -07:00

View File

@@ -88,6 +88,12 @@ static CGFloat centerInset(CGFloat outer, CGFloat inner)
MAX(0, constrainedSize.max.height - insetsY),
}
};
if (self.child == nil) {
ASDisplayNodeAssert(NO, @"Inset spec measured without a child. The spec will do nothing.");
return [ASLayout layoutWithLayoutableObject:self size:CGSizeZero];
}
ASLayout *sublayout = [self.child measureWithSizeRange:insetConstrainedSize];
const CGSize computedSize = ASSizeRangeClamp(constrainedSize, {