Skip to content

Commit

Permalink
fix: Add missing nan value checks for bounds size (#2220)
Browse files Browse the repository at this point in the history
This PR adds missing checks whether SVG bounds size values are nan. This PR should fix [this](#978) old issue that still happens sometimes.
  • Loading branch information
MatiPl01 committed Feb 26, 2024
1 parent e6b2cc6 commit b7b6a4f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apple/RNSVGRenderable.mm
Expand Up @@ -475,7 +475,9 @@ - (void)renderLayerTo:(CGContextRef)context rect:(CGRect)rect
CGPoint mid = CGPointMake(CGRectGetMidX(pathBounds), CGRectGetMidY(pathBounds));
CGPoint center = CGPointApplyAffineTransform(mid, matrix);

self.bounds = bounds;
if (!isnan(bounds.size.width) && !isnan(bounds.size.height)) {
self.bounds = bounds;
}
if (!isnan(center.x) && !isnan(center.y)) {
self.center = center;
}
Expand Down

0 comments on commit b7b6a4f

Please sign in to comment.