mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-16 19:30:29 +00:00
fix crash when setting layoutSpec's child to nil
This commit is contained in:
parent
096f20c8d5
commit
cf2d9aef5c
@ -117,8 +117,10 @@
|
|||||||
ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable");
|
ASDisplayNodeAssert(self.isMutable, @"Cannot set properties when layout spec is not mutable");
|
||||||
|
|
||||||
id<ASLayoutable> finalLayoutable = [self layoutableToAddFromLayoutable:child];
|
id<ASLayoutable> finalLayoutable = [self layoutableToAddFromLayoutable:child];
|
||||||
|
if (finalLayoutable) {
|
||||||
_children = @[finalLayoutable];
|
_children = @[finalLayoutable];
|
||||||
[self propagateUpLayoutable:finalLayoutable];
|
[self propagateUpLayoutable:finalLayoutable];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setChild:(id<ASLayoutable>)child forIdentifier:(NSString *)identifier
|
- (void)setChild:(id<ASLayoutable>)child forIdentifier:(NSString *)identifier
|
||||||
@ -127,7 +129,9 @@
|
|||||||
|
|
||||||
id<ASLayoutable> finalLayoutable = [self layoutableToAddFromLayoutable:child];
|
id<ASLayoutable> finalLayoutable = [self layoutableToAddFromLayoutable:child];
|
||||||
self.childrenWithIdentifier[identifier] = finalLayoutable;
|
self.childrenWithIdentifier[identifier] = finalLayoutable;
|
||||||
|
if (finalLayoutable) {
|
||||||
self.children = [self.children arrayByAddingObject:finalLayoutable];
|
self.children = [self.children arrayByAddingObject:finalLayoutable];
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Should we propagate up the layoutable at it could happen that multiple children will propagated up their
|
// TODO: Should we propagate up the layoutable at it could happen that multiple children will propagated up their
|
||||||
// layout options and one child will overwrite values from another child
|
// layout options and one child will overwrite values from another child
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user