Skip to content

Commit 188ca9a

Browse files
authored
Merge pull request #6522 from mhugent/fix_18247
Fallback to feature id if pk attribute is not there
2 parents 45f04b7 + b0d3548 commit 188ca9a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/server/qgsowsserver.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,13 @@ QString QgsOWSServer::featureGmlId( const QgsFeature* f, const QgsAttributeList&
8585
{
8686
pkId.append( pkSeparator() );
8787
}
88-
pkId.append( f->attribute( *it ).toString() );
88+
89+
QVariant pkAttribute = f->attribute( *it );
90+
if ( !pkAttribute.isValid() )
91+
{
92+
return QString::number( f->id() );
93+
}
94+
pkId.append( pkAttribute.toString() );
8995
}
9096
return pkId;
9197
}

0 commit comments

Comments
 (0)