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:
Jakub Grzywacz
2024-10-17 11:34:37 +02:00
committed by GitHub
parent 93df20ca3f
commit 16baf27a50
2 changed files with 4 additions and 1 deletions

View File

@@ -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());