mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Copy sublayers to avoid NSFastEnumerationMutation exception
This commit is contained in:
@@ -51,7 +51,9 @@ extern void ASDisplayNodePerformBlockOnEveryNode(CALayer *layer, ASDisplayNode *
|
||||
}
|
||||
|
||||
if (layer) {
|
||||
for (CALayer *sublayer in [layer sublayers]) {
|
||||
/// NOTE: The docs say `sublayers` returns a copy, but it does not.
|
||||
/// See: http://stackoverflow.com/questions/14854480/collection-calayerarray-0x1ed8faa0-was-mutated-while-being-enumerated
|
||||
for (CALayer *sublayer in [[layer sublayers] copy]) {
|
||||
ASDisplayNodePerformBlockOnEveryNode(sublayer, nil, block);
|
||||
}
|
||||
} else if (node) {
|
||||
|
||||
Reference in New Issue
Block a user