获取widget组件容错处理

This commit is contained in:
Yida.Xu 2025-05-14 18:33:53 +08:00 committed by GitHub
parent cdefb153bb
commit 9b68182e90
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -574,7 +574,7 @@ export class YXCollectionView extends Component {
let transform = content.getComponent(UITransform) || content.addComponent(UITransform)
transform.contentSize = this.node.getComponent(UITransform).contentSize
this.getComponent(Widget).updateAlignment?.();
this.getComponent(Widget)?.updateAlignment?.();
result.content = content
}