Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add guards for MagickImage.BilateralBlur #1545

Merged
merged 4 commits into from
Feb 9, 2024

Conversation

Gounlaf
Copy link
Sponsor Contributor

@Gounlaf Gounlaf commented Feb 9, 2024

👋

Same could be done for intensitySigma & spatialSigma, but ImageMagick always multiply each param by itself, making them always positive.

On one hand, it's already "safe".
On the other hand, there is nothing (at least comments) telling it must be > 0.

Regards.

Edit: added the exception tag that was missing (even without my modifications)

@dlemstra
Copy link
Owner

dlemstra commented Feb 9, 2024

In your other PR you used Throw.IfNegative. I think I would prefer to have a consistent api and also use that here. And I don't think I would want to have the (>0) in the xml comments. And you should also update the interface to add this: /// <exception cref="MagickException">Thrown when an error is raised by ImageMagick.</exception>.

@Gounlaf
Copy link
Sponsor Contributor Author

Gounlaf commented Feb 9, 2024

PR Updated according to your requests 🙂

Throw.IfFalse(nameof(width), width > 1, "The width must be > 1");
Throw.IfFalse(nameof(height), height > 1, "The height must be > 1");
Throw.IfNegative(nameof(width), width);
Throw.IfNegative(nameof(height), height);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a newline after the Thow's? I do that in the rest of the library.

p.s. I missed that in your other pr...

Copy link
Sponsor Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

@dlemstra dlemstra merged commit 830f7d8 into dlemstra:main Feb 9, 2024
25 checks passed
@Gounlaf Gounlaf deleted the magickimage-bilateralblur-guards branch February 9, 2024 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants