iOS: protect setFrame incase crash

This commit is contained in:
pengfei.zhou 2022-08-02 11:02:03 +08:00 committed by osborn
parent 6e3307d400
commit 7f6710a7b5

View File

@ -262,6 +262,13 @@ - (void)setFrame {
}
BOOL isFrameChange = ![self rect:originFrame equalTo:self.view.frame];
if (isFrameChange) {
if (isnan(originFrame.origin.x) || isinf(originFrame.origin.x)
|| isnan(originFrame.origin.y) || isinf(originFrame.origin.y)
|| isnan(originFrame.size.width) || isinf(originFrame.size.width)
|| isnan(originFrame.size.height) || isinf(originFrame.size.height)
) {
return;
}
self.view.frame = originFrame;
}
if (!UIEdgeInsetsEqualToEdgeInsets(self.corners, UIEdgeInsetsZero)) {