mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-06 07:06:11 +00:00
fix: crop rect invalid bounds crash (#2494)
# Summary
Do not crash on `getCropRect` call when renderableBounds is null
## Compatibility
| OS | Implemented |
| ------- | :---------: |
| Android | ✅ |
This commit is contained in:
@@ -36,6 +36,9 @@ public class FilterRegion {
|
||||
|
||||
public Rect getCropRect(VirtualView view, FilterProperties.Units units, RectF bounds) {
|
||||
double x, y, width, height;
|
||||
if (bounds == null) {
|
||||
return new Rect(0, 0, 0, 0);
|
||||
}
|
||||
if (units == FilterProperties.Units.OBJECT_BOUNDING_BOX) {
|
||||
x = bounds.left + view.relativeOnFraction(this.mX, bounds.width());
|
||||
y = bounds.top + view.relativeOnFraction(this.mY, bounds.height());
|
||||
|
||||
Reference in New Issue
Block a user