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(regexp_replace): handle null value #59186

Closed
wants to merge 1 commit into from

Conversation

lbartoletti
Copy link
Member

Description

Resurrect Fix for #44274

@lbartoletti lbartoletti self-assigned this Oct 24, 2024
@github-actions github-actions bot added this to the 3.40.0 milestone Oct 24, 2024
@lbartoletti lbartoletti added Expressions Related to the QGIS expression engine or specific expression functions backport release-3_34 labels Oct 24, 2024
Copy link

github-actions bot commented Oct 24, 2024

🪟 Windows builds

Download Windows builds of this PR for testing.
Debug symbols for this build are available here.
(Built from commit cde87e7)

🪟 Windows Qt6 builds

Download Windows Qt6 builds of this PR for testing.
(Built from commit cde87e7)

@@ -1609,13 +1609,20 @@ static QVariant fcnRegexpReplace( const QVariantList &values, const QgsExpressio
QString str = QgsExpressionUtils::getStringValue( values.at( 0 ), parent );
QString regexp = QgsExpressionUtils::getStringValue( values.at( 1 ), parent );
QString after = QgsExpressionUtils::getStringValue( values.at( 2 ), parent );
bool isValid_after{ values.at( 2 ).isValid() };
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
bool isValid_after{ values.at( 2 ).isValid() };
bool isValid_after{ values.at( 2 ).isValid() && !values.at( 2 ).isNull() };

Not sure of myself here. But I'm also wondering if just the isNull() condition wouldn't be enough ?

In your test, if you replace QVariant with QVariant( QMetaType::String ) for instance, it would be valid and null, and so your fix wouldn't work, no?

Copy link
Collaborator

Choose a reason for hiding this comment

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

We should always use QgsVariantUtils::isNull for these checks.

Copy link

github-actions bot commented Nov 8, 2024

The QGIS project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 14 days and is being automatically marked as "stale". If you think this pull request should be merged, please check

  • that all unit tests are passing

  • that all comments by reviewers have been addressed

  • that there is enough information for reviewers, in particular

    • link to any issues which this pull request fixes

    • add a description of workflows which this pull request fixes

    • add screenshots if applicable

  • that you have written unit tests where possible
    In case you should have any uncertainty, please leave a comment and we will be happy to help you proceed with this pull request.
    If there is no further activity on this pull request, it will be closed in a week.

@github-actions github-actions bot added the stale Uh oh! Seems this work is abandoned, and the PR is about to close. label Nov 8, 2024
Copy link

While we hate to see this happen, this PR has been automatically closed because it has not had any activity in the last 21 days. If this pull request should be reconsidered, please follow the guidelines in the previous comment and reopen this pull request. Or, if you have any further questions, just ask! We love to help, and if there's anything the QGIS project can do to help push this PR forward please let us know how we can assist.

@github-actions github-actions bot closed this Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Expressions Related to the QGIS expression engine or specific expression functions stale Uh oh! Seems this work is abandoned, and the PR is about to close.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants