Using blur on a surface with either width or height equal to 0 won't raise a ValueError #2852
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I tried to fix issue #2849 and I tested locally that surfaces with either width == 0 or height == 0 won't raise a misleading error message. I also moved the comparison between
dst
andsrc
sizes as ifsrc
is (30, 50) anddst
is (0, 20), without moving the check, the function would have passed returning a (0, 20) sized surface which would probably cause bugs, bothsrc
anddst
must have the same zero sizes for it to return gracefully.Why not an exception? Like the issue creator said, all transform functions handle zero sized surfaces which are even returned some times (
pygame.Font.render
) so this one should be consistent. If you find anything wrong with my changes let me know.I also modified the docs and added a test.