Skip to content

Commit

Permalink
fix: apple empty filter results (#2393)
Browse files Browse the repository at this point in the history
# Summary

When there is no content of CGImage, ref will return `nil` instead of
empty image and crash, we should ignore that results and continue
applying filters.

## Example 
```tsx
<svg width="200" height="200">
  <filter id="offset">
    <feOffset dx="1000" dy="1000" />
  </filter>
  <rect
    x="0"
    y="0"
    width="100"
    height="100"
    fill="green"
    filter="url(#offset)" />
</svg>
```
  • Loading branch information
jakex7 committed Aug 5, 2024
1 parent e88e640 commit d78e90e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion apple/Filters/RNSVGFilter.mm
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ - (CIImage *)applyFilter:(CIImage *)img
fromRect:[result extent]];
result = [CIImage imageWithCGImage:cgResult];
CGImageRelease(cgResult);
if (currentFilter.result) {
if (result != nil && currentFilter.result) {
[resultsMap setObject:result forKey:currentFilter.result];
}
} else {
Expand Down

0 comments on commit d78e90e

Please sign in to comment.