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

[processing] Random points in polygons: fix NULL exp returning 1 #58815

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

elpaso
Copy link
Contributor

@elpaso elpaso commented Sep 20, 2024

When POINTS_NUMBER is set to an expression and the expression evaluation returns an invalid value, set the value to 0 instead of 1 (which is logically the min value for the fixed number option).

Fix #58737

When POINTS_NUMBER is set to an expression and the expression
evaluation returns an invalid value, set the value to 0 instead
of 1 (which is logically the min value for the fixed number option).

Fixes qgis#58737
@elpaso elpaso added Processing Relating to QGIS Processing framework or individual Processing algorithms Bug Either a bug report, or a bug fix. Let's hope for the latter! labels Sep 20, 2024
@github-actions github-actions bot added this to the 3.40.0 milestone Sep 20, 2024
@agiudiceandrea
Copy link
Contributor

agiudiceandrea commented Sep 20, 2024

It seems to me just changing:

numberPointsForThisFeature = mNumPointsProperty.valueAsInt( expressionContext, numberPointsForThisFeature );

to

numberPointsForThisFeature = mNumPointsProperty.valueAsInt( expressionContext, 0 );

would fix the issue.

Copy link

github-actions bot commented Sep 20, 2024

🪟 Windows builds ready!

Windows builds of this PR are available for testing here. Debug symbols for this build are available here.

(Built from commit 3df5c79)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Random Points in Polygons behaves unexpectedly
2 participants