Skip to content
This repository has been archived by the owner on May 27, 2022. It is now read-only.

Commit

Permalink
Merge pull request #102 from opengisch/number_null_fix
Browse files Browse the repository at this point in the history
Apply QGIS patch to fix attribute comparison when updating features
  • Loading branch information
nirvn authored Apr 13, 2021
2 parents cdb5c32 + c0fa5d0 commit 131b273
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
23 changes: 23 additions & 0 deletions recipes/qgis/patches/update_feature_fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
From 623334af769aab1967f1237d03fab35fc3d18ca0 Mon Sep 17 00:00:00 2001
From: nirvn <[email protected]>
Date: Tue, 13 Apr 2021 12:30:29 +0700
Subject: [PATCH] [vectorlayer] Fix updateFeature() when an attribute's variant
goes from null to default null value

---
src/core/vector/qgsvectorlayer.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/core/vector/qgsvectorlayer.cpp b/src/core/vector/qgsvectorlayer.cpp
index 2aae763c71..1b35f35288 100644
--- a/src/core/vector/qgsvectorlayer.cpp
+++ b/src/core/vector/qgsvectorlayer.cpp
@@ -1074,7 +1074,7 @@ bool QgsVectorLayer::updateFeature( QgsFeature &updatedFeature, bool skipDefault

for ( int attr = 0; attr < fa.count(); ++attr )
{
- if ( fa.at( attr ) != ca.at( attr ) )
+ if ( !qgsVariantEqual( fa.at( attr ), ca.at( attr ) ) )
{
if ( changeAttributeValue( updatedFeature.id(), attr, fa.at( attr ), ca.at( attr ), true ) )
{
2 changes: 2 additions & 0 deletions recipes/qgis/recipe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ function prebuild_qgis() {
return
fi

try patch -p1 < $RECIPE_qgis/patches/update_feature_fix.patch

touch .patched
}

Expand Down

0 comments on commit 131b273

Please sign in to comment.