mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-15 18:59:54 +00:00
Don't allow unitialized or under constrained layouts cause a crash.
Should I move the pixel bounds rounding to here instead of leaving it in ASLayout?
This commit is contained in:
parent
71c44843c8
commit
2e6e81e66b
@ -1816,8 +1816,28 @@ void recursivelyEnsureDisplayForLayer(CALayer *layer)
|
||||
CGRect subnodeFrame = CGRectZero;
|
||||
for (ASLayout *subnodeLayout in _layout.sublayouts) {
|
||||
ASDisplayNodeAssert([_subnodes containsObject:subnodeLayout.layoutableObject], @"Cached sublayouts must only contain subnodes' layout.");
|
||||
subnodeFrame.origin = subnodeLayout.position;
|
||||
subnodeFrame.size = subnodeLayout.size;
|
||||
CGPoint adjustedOrigin = subnodeLayout.position;
|
||||
if (isfinite(adjustedOrigin.x) == NO) {
|
||||
ASDisplayNodeAssert(0, @"subnodeLayout has an invalid position");
|
||||
adjustedOrigin.x = 0;
|
||||
}
|
||||
if (isfinite(adjustedOrigin.y) == NO) {
|
||||
ASDisplayNodeAssert(0, @"subnodeLayout has an invalid position");
|
||||
adjustedOrigin.y = 0;
|
||||
}
|
||||
subnodeFrame.origin = adjustedOrigin;
|
||||
|
||||
CGSize adjustedSize = subnodeLayout.size;
|
||||
if (isfinite(adjustedSize.width) == NO) {
|
||||
ASDisplayNodeAssert(0, @"subnodeLayout has an invalid size");
|
||||
adjustedSize.width = 0;
|
||||
}
|
||||
if (isfinite(adjustedSize.height) == NO) {
|
||||
ASDisplayNodeAssert(0, @"subnodeLayout has an invalid position");
|
||||
adjustedSize.height = 0;
|
||||
}
|
||||
subnodeFrame.size = adjustedSize;
|
||||
|
||||
subnode = ((ASDisplayNode *)subnodeLayout.layoutableObject);
|
||||
[subnode setFrame:subnodeFrame];
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user