Skip to content

Commit 0b7416f

Browse files
committedNov 6, 2018
Remove QgsGeometry bool operator
This is too dangerous -- it gets silently casted to numeric values instead of throwing compilation errors (cherry picked from commit 7be2925)
1 parent 5431d5a commit 0b7416f

40 files changed

+66
-93
lines changed
 

‎python/core/auto_generated/geometry/qgsgeometry.sip.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1824,8 +1824,6 @@ Downgrades a point list from QgsPoint to :py:class:`QgsPointXY`
18241824

18251825
operator QVariant() const;
18261826

1827-
operator bool() const;
1828-
18291827
}; // class QgsGeometry
18301828

18311829

‎src/analysis/interpolation/qgsinterpolator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ QgsInterpolator::Result QgsInterpolator::cacheBaseData( QgsFeedback *feedback )
114114

115115
bool QgsInterpolator::addVerticesToCache( const QgsGeometry &geom, ValueSource source, double attributeValue )
116116
{
117-
if ( !geom || geom.isEmpty() )
117+
if ( geom.isNull() || geom.isEmpty() )
118118
return true; // nothing to do
119119

120120
//validate source

‎src/analysis/processing/qgsalgorithmboundary.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ QgsFeatureList QgsBoundaryAlgorithm::processFeature( const QgsFeature &feature,
109109
{
110110
QgsGeometry inputGeometry = feature.geometry();
111111
QgsGeometry outputGeometry = QgsGeometry( inputGeometry.constGet()->boundary() );
112-
if ( !outputGeometry )
112+
if ( outputGeometry.isNull() )
113113
{
114114
feedback->reportError( QObject::tr( "No boundary for feature %1 (possibly a closed linestring?)'" ).arg( feature.id() ) );
115115
outFeature.clearGeometry();

‎src/analysis/processing/qgsalgorithmbuffer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ QVariantMap QgsBufferAlgorithm::processAlgorithm( const QVariantMap &parameters,
136136
}
137137

138138
QgsGeometry outputGeometry = f.geometry().buffer( distance, segments, endCapStyle, joinStyle, miterLimit );
139-
if ( !outputGeometry )
139+
if ( outputGeometry.isNull() )
140140
{
141141
QgsMessageLog::logMessage( QObject::tr( "Error calculating buffer for feature %1" ).arg( f.id() ), QObject::tr( "Processing" ), Qgis::Warning );
142142
}

‎src/analysis/processing/qgsalgorithmcentroid.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ QgsFeatureList QgsCentroidAlgorithm::processFeature( const QgsFeature &f, QgsPro
104104
{
105105
QgsGeometry partGeometry( geomCollection->geometryN( i )->clone() );
106106
QgsGeometry outputGeometry = partGeometry.centroid();
107-
if ( !outputGeometry )
107+
if ( outputGeometry.isNull() )
108108
{
109109
feedback->pushInfo( QObject::tr( "Error calculating centroid for feature %1 part %2: %3" ).arg( feature.id() ).arg( i ).arg( outputGeometry.lastError() ) );
110110
}
@@ -115,7 +115,7 @@ QgsFeatureList QgsCentroidAlgorithm::processFeature( const QgsFeature &f, QgsPro
115115
else
116116
{
117117
QgsGeometry outputGeometry = feature.geometry().centroid();
118-
if ( !outputGeometry )
118+
if ( outputGeometry.isNull() )
119119
{
120120
feedback->pushInfo( QObject::tr( "Error calculating centroid for feature %1: %2" ).arg( feature.id() ).arg( outputGeometry.lastError() ) );
121121
}

‎src/analysis/processing/qgsalgorithmconvexhull.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ QgsFeatureList QgsConvexHullAlgorithm::processFeature( const QgsFeature &feature
8383
else
8484
{
8585
outputGeometry = f.geometry().convexHull();
86-
if ( !outputGeometry )
86+
if ( outputGeometry.isNull() )
8787
feedback->reportError( outputGeometry.lastError() );
8888
f.setGeometry( outputGeometry );
8989
}
90-
if ( outputGeometry )
90+
if ( !outputGeometry.isNull() )
9191
{
9292
QgsAttributes attrs = f.attributes();
9393
attrs << outputGeometry.constGet()->area()

‎src/analysis/processing/qgsalgorithmdissolve.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ QVariantMap QgsCollectorAlgorithm::processCollection( const QVariantMap &paramet
6767
firstFeature = false;
6868
}
6969

70-
if ( f.hasGeometry() && f.geometry() )
70+
if ( f.hasGeometry() && !f.geometry().isNull() )
7171
{
7272
geomQueue.append( f.geometry() );
7373
if ( maxQueueLength > 0 && geomQueue.length() > maxQueueLength )
@@ -118,7 +118,7 @@ QVariantMap QgsCollectorAlgorithm::processCollection( const QVariantMap &paramet
118118
attributeHash.insert( indexAttributes, f.attributes() );
119119
}
120120

121-
if ( f.hasGeometry() && f.geometry() )
121+
if ( f.hasGeometry() && !f.geometry().isNull() )
122122
{
123123
geometryHash[ indexAttributes ].append( f.geometry() );
124124
}

‎src/analysis/processing/qgsalgorithmextendlines.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ QgsFeatureList QgsExtendLinesAlgorithm::processFeature( const QgsFeature &featur
129129
endDistance = mEndDistanceProperty.valueAsDouble( context.expressionContext(), endDistance );
130130

131131
const QgsGeometry outGeometry = geometry.extendLine( startDistance, endDistance );
132-
if ( !outGeometry )
132+
if ( outGeometry.isNull() )
133133
throw QgsProcessingException( QObject::tr( "Error calculating extended line" ) ); // don't think this can actually happen!
134134

135135
f.setGeometry( outGeometry );

‎src/analysis/processing/qgsalgorithmfixgeometries.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ QgsFeatureList QgsFixGeometriesAlgorithm::processFeature( const QgsFeature &feat
9393
QgsFeature outputFeature = feature;
9494

9595
QgsGeometry outputGeometry = outputFeature.geometry().makeValid();
96-
if ( !outputGeometry )
96+
if ( outputGeometry.isNull() )
9797
{
9898
feedback->pushInfo( QObject::tr( "makeValid failed for feature %1 " ).arg( feature.id() ) );
9999
outputFeature.clearGeometry();

‎src/analysis/processing/qgsalgorithmkmeansclustering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ QVariantMap QgsKMeansClusteringAlgorithm::processAlgorithm( const QVariantMap &p
115115
else
116116
{
117117
QgsGeometry centroid = feat.geometry().centroid();
118-
if ( !centroid )
118+
if ( centroid.isNull() )
119119
continue; // centroid failed, e.g. empty linestring
120120

121121
point = QgsPointXY( *qgsgeometry_cast< const QgsPoint * >( centroid.constGet() ) );

‎src/analysis/processing/qgsalgorithmmergelines.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ QgsFeatureList QgsMergeLinesAlgorithm::processFeature( const QgsFeature &feature
8383

8484
QgsFeature out = feature;
8585
QgsGeometry outputGeometry = feature.geometry().mergeLines();
86-
if ( !outputGeometry )
86+
if ( outputGeometry.isNull() )
8787
feedback->reportError( QObject::tr( "Error merging lines for feature %1" ).arg( feature.id() ) );
8888

8989
out.setGeometry( outputGeometry );

‎src/analysis/processing/qgsalgorithmmultiringconstantbuffer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ QgsFeatureList QgsMultiRingConstantBufferAlgorithm::processFeature( const QgsFea
133133
QgsFeature out;
134134
currentDistance = i * distance;
135135
outputGeometry = feature.geometry().buffer( currentDistance, 40 );
136-
if ( !outputGeometry )
136+
if ( outputGeometry.isNull() )
137137
{
138138
feedback->reportError( QObject::tr( "Error calculating buffer for feature %1" ).arg( feature.id() ) );
139139
continue;

‎src/analysis/processing/qgsalgorithmpointonsurface.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ QgsFeatureList QgsPointOnSurfaceAlgorithm::processFeature( const QgsFeature &f,
102102
{
103103
QgsGeometry partGeometry( geomCollection->geometryN( i )->clone() );
104104
QgsGeometry outputGeometry = partGeometry.pointOnSurface();
105-
if ( !outputGeometry )
105+
if ( outputGeometry.isNull() )
106106
{
107107
feedback->pushInfo( QObject::tr( "Error calculating point on surface for feature %1 part %2: %3" ).arg( feature.id() ).arg( i ).arg( outputGeometry.lastError() ) );
108108
}
@@ -113,7 +113,7 @@ QgsFeatureList QgsPointOnSurfaceAlgorithm::processFeature( const QgsFeature &f,
113113
else
114114
{
115115
QgsGeometry outputGeometry = feature.geometry().pointOnSurface();
116-
if ( !outputGeometry )
116+
if ( outputGeometry.isNull() )
117117
{
118118
feedback->pushInfo( QObject::tr( "Error calculating point on surface for feature %1: %2" ).arg( feature.id() ).arg( outputGeometry.lastError() ) );
119119
}

‎src/analysis/processing/qgsalgorithmrotate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ QgsFeatureList QgsRotateFeaturesAlgorithm::processFeature( const QgsFeature &fea
129129
else
130130
{
131131
QgsGeometry centroid = geometry.centroid();
132-
if ( centroid )
132+
if ( !centroid.isNull() )
133133
{
134134
geometry.rotate( angle, centroid.asPoint() );
135135
f.setGeometry( geometry );

‎src/analysis/processing/qgsalgorithmsmooth.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ QgsFeatureList QgsSmoothAlgorithm::processFeature( const QgsFeature &feature, Qg
147147
maxAngle = mMaxAngleProperty.valueAsDouble( context.expressionContext(), maxAngle );
148148

149149
QgsGeometry outputGeometry = f.geometry().smooth( iterations, offset, -1, maxAngle );
150-
if ( !outputGeometry )
150+
if ( outputGeometry.isNull() )
151151
{
152152
feedback->reportError( QObject::tr( "Error smoothing geometry %1" ).arg( feature.id() ) );
153153
}

‎src/analysis/processing/qgsalgorithmsnaptogrid.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ QgsFeatureList QgsSnapToGridAlgorithm::processFeature( const QgsFeature &feature
145145
intervalM = mIntervalMProperty.valueAsDouble( context.expressionContext(), intervalM );
146146

147147
QgsGeometry outputGeometry = f.geometry().snappedToGrid( intervalX, intervalY, intervalZ, intervalM );
148-
if ( !outputGeometry )
148+
if ( outputGeometry.isNull() )
149149
{
150150
feedback->reportError( QObject::tr( "Error snapping geometry %1" ).arg( feature.id() ) );
151151
}

‎src/analysis/processing/qgsalgorithmsplitwithlines.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ QVariantMap QgsSplitWithLinesAlgorithm::processAlgorithm( const QVariantMap &par
192192
}
193193

194194
QgsGeometry inGeom = inGeoms.takeFirst();
195-
if ( !inGeom )
195+
if ( inGeom.isNull() )
196196
continue;
197197

198198
if ( splitGeomEngine->intersects( inGeom.constGet() ) )

‎src/analysis/processing/qgsalgorithmsubdivide.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ QgsFeatureList QgsSubdivideAlgorithm::processFeature( const QgsFeature &f, QgsPr
9090
maxNodes = mMaxNodesProperty.valueAsDouble( context.expressionContext(), maxNodes );
9191

9292
feature.setGeometry( feature.geometry().subdivide( maxNodes ) );
93-
if ( !feature.geometry() )
93+
if ( !feature.hasGeometry() )
9494
{
9595
feedback->reportError( QObject::tr( "Error calculating subdivision for feature %1" ).arg( feature.id() ) );
9696
}

‎src/analysis/processing/qgsalgorithmtaperedbuffer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ QgsFeatureList QgsTaperedBufferAlgorithm::processFeature( const QgsFeature &feat
141141
endWidth = mEndWidthProperty.valueAsDouble( context.expressionContext(), endWidth );
142142

143143
QgsGeometry outputGeometry = feature.geometry().taperedBuffer( startWidth, endWidth, segments );
144-
if ( !outputGeometry )
144+
if ( outputGeometry.isNull() )
145145
{
146146
feedback->reportError( QObject::tr( "Error buffering geometry %1: %2" ).arg( feature.id() ).arg( outputGeometry.lastError() ) );
147147
}
@@ -241,7 +241,7 @@ QgsFeatureList QgsVariableWidthBufferByMAlgorithm::processFeature( const QgsFeat
241241
segments = mSegmentsProperty.valueAsInt( context.expressionContext(), segments );
242242

243243
QgsGeometry outputGeometry = feature.geometry().variableWidthBufferByM( segments );
244-
if ( !outputGeometry )
244+
if ( outputGeometry.isNull() )
245245
{
246246
feedback->reportError( QObject::tr( "Error buffering geometry %1: %2" ).arg( feature.id() ).arg( outputGeometry.lastError() ) );
247247
}

‎src/analysis/vector/geometry_checker/qgsgeometrycheckerutils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ QgsGeometryCheckerUtils::LayerFeature::LayerFeature( const QgsFeaturePool *pool,
4545
{
4646
mGeometry.transform( transform );
4747
}
48-
catch ( const QgsCsException &e )
48+
catch ( const QgsCsException & )
4949
{
5050
QgsDebugMsg( QStringLiteral( "Shrug. What shall we do with a geometry that cannot be converted?" ) );
5151
}
@@ -195,7 +195,7 @@ bool QgsGeometryCheckerUtils::LayerFeatures::iterator::nextFeature( bool begin )
195195
if ( mParent->mFeedback )
196196
mParent->mFeedback->setProgress( mParent->mFeedback->progress() + 1.0 );
197197
QgsFeature feature;
198-
if ( featurePool->getFeature( *mFeatureIt, feature ) && feature.geometry() && feature.geometry().constGet() )
198+
if ( featurePool->getFeature( *mFeatureIt, feature ) && !feature.geometry().isNull() )
199199
{
200200
mCurrentFeature.reset( new LayerFeature( mParent->mFeaturePools[*mLayerIt], feature, mParent->mContext, mParent->mUseMapCrs ) );
201201
return true;

‎src/analysis/vector/geometry_checker/qgssinglegeometrycheck.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ void QgsSingleGeometryCheckError::update( const QgsSingleGeometryCheckError *oth
4949

5050
bool QgsSingleGeometryCheckError::isEqual( const QgsSingleGeometryCheckError *other ) const
5151
{
52-
return mGeometry == other->mGeometry
52+
return mGeometry.equals( other->mGeometry )
5353
&& mCheck == other->mCheck
54-
&& mErrorLocation == other->mErrorLocation
54+
&& mErrorLocation.equals( other->mErrorLocation )
5555
&& mVertexId == other->mVertexId;
5656
}
5757

‎src/analysis/vector/geometry_checker/qgsvectordataproviderfeaturepool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ QgsVectorDataProviderFeaturePool::QgsVectorDataProviderFeaturePool( QgsVectorLay
3535
QgsFeatureIterator it = layer->getFeatures( req );
3636
while ( it.nextFeature( feature ) )
3737
{
38-
if ( feature.geometry() )
38+
if ( feature.hasGeometry() )
3939
{
4040
insertFeature( feature );
4141
featureIds.insert( feature.id() );

‎src/app/qgsidentifyresultsdialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1631,7 +1631,7 @@ void QgsIdentifyResultsDialog::highlightFeature( QTreeWidgetItem *item )
16311631
if ( mHighlights.contains( featItem ) )
16321632
return;
16331633

1634-
if ( !featItem->feature().geometry() || featItem->feature().geometry().wkbType() == QgsWkbTypes::Unknown )
1634+
if ( !featItem->feature().hasGeometry() || featItem->feature().geometry().wkbType() == QgsWkbTypes::Unknown )
16351635
return;
16361636

16371637
QgsHighlight *highlight = nullptr;

‎src/app/qgsmaptooloffsetcurve.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ void QgsMapToolOffsetCurve::updateGeometryAndRubberBand( double offset )
594594
offsetGeom = mManipulatedGeometry.buffer( offset, quadSegments, capStyle, joinStyle, miterLimit );
595595
}
596596

597-
if ( !offsetGeom )
597+
if ( offsetGeom.isNull() )
598598
{
599599
deleteRubberBandAndGeometry();
600600
deleteUserInputWidget();

‎src/app/qgsmaptoolreverseline.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ void QgsMapToolReverseLine::canvasReleaseEvent( QgsMapMouseEvent *e )
115115

116116
}
117117

118-
if ( geom )
118+
if ( !geom.isNull() )
119119
{
120120
vlayer->beginEditCommand( tr( "Reverse line" ) );
121121
vlayer->changeGeometry( f.id(), geom );

‎src/core/geometry/qgsgeometry.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ QgsGeometry::OperationResult QgsGeometry::addPart( const QgsGeometry &newPart )
729729
{
730730
return QgsGeometry::InvalidBaseGeometry;
731731
}
732-
if ( !newPart || !newPart.d->geometry )
732+
if ( newPart.isNull() || !newPart.d->geometry )
733733
{
734734
return QgsGeometry::AddPartNotMultiGeometry;
735735
}
@@ -752,7 +752,7 @@ QgsGeometry QgsGeometry::removeInteriorRings( double minimumRingArea ) const
752752
for ( const QgsGeometry &part : parts )
753753
{
754754
QgsGeometry result = part.removeInteriorRings( minimumRingArea );
755-
if ( result )
755+
if ( !result.isNull() )
756756
results << result;
757757
}
758758
if ( results.isEmpty() )
@@ -1729,7 +1729,7 @@ QgsGeometry QgsGeometry::offsetCurve( double distance, int segments, JoinStyle j
17291729
for ( const QgsGeometry &part : parts )
17301730
{
17311731
QgsGeometry result = part.offsetCurve( distance, segments, joinStyle, miterLimit );
1732-
if ( result )
1732+
if ( !result.isNull() )
17331733
results << result;
17341734
}
17351735
if ( results.isEmpty() )
@@ -1772,7 +1772,7 @@ QgsGeometry QgsGeometry::singleSidedBuffer( double distance, int segments, Buffe
17721772
for ( const QgsGeometry &part : parts )
17731773
{
17741774
QgsGeometry result = part.singleSidedBuffer( distance, segments, side, joinStyle, miterLimit );
1775-
if ( result )
1775+
if ( !result.isNull() )
17761776
results << result;
17771777
}
17781778
if ( results.isEmpty() )
@@ -1830,7 +1830,7 @@ QgsGeometry QgsGeometry::extendLine( double startDistance, double endDistance )
18301830
for ( const QgsGeometry &part : parts )
18311831
{
18321832
QgsGeometry result = part.extendLine( startDistance, endDistance );
1833-
if ( result )
1833+
if ( !result.isNull() )
18341834
results << result;
18351835
}
18361836
if ( results.isEmpty() )
@@ -2675,11 +2675,6 @@ void QgsGeometry::convertPointList( const QgsPointSequence &input, QVector<QgsPo
26752675
}
26762676
}
26772677

2678-
QgsGeometry::operator bool() const
2679-
{
2680-
return d->geometry.get();
2681-
}
2682-
26832678
void QgsGeometry::convertToPolyline( const QgsPointSequence &input, QgsPolylineXY &output )
26842679
{
26852680
output.clear();

‎src/core/geometry/qgsgeometry.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1823,13 +1823,6 @@ class CORE_EXPORT QgsGeometry
18231823
return QVariant::fromValue( *this );
18241824
}
18251825

1826-
/**
1827-
* Returns true if the geometry is non empty (ie, isNull() returns false),
1828-
* or false if it is an empty, uninitialized geometry (ie, isNull() returns true).
1829-
* \since QGIS 3.0
1830-
*/
1831-
operator bool() const;
1832-
18331826
private:
18341827

18351828
QgsGeometryPrivate *d; //implicitly shared data pointer

‎src/core/geometry/qgsgeos.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ QgsAbstractGeometry *QgsGeos::combine( const QVector<QgsGeometry> &geomList, QSt
393393
geosGeometries.reserve( geomList.size() );
394394
for ( const QgsGeometry &g : geomList )
395395
{
396-
if ( !g )
396+
if ( g.isNull() )
397397
continue;
398398

399399
geosGeometries << asGeos( g.constGet(), mPrecision ).release();

‎src/core/qgsmaphittest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ void QgsMapHitTest::runHitTestLayer( QgsVectorLayer *vl, SymbolSet &usedSymbols,
152152
{
153153
context.expressionContext().setFeature( f );
154154
// filter out elements outside of the polygon
155-
if ( f.geometry() && polygonEngine )
155+
if ( f.hasGeometry() && polygonEngine )
156156
{
157157
if ( !polygonEngine->intersects( f.geometry().constGet() ) )
158158
{

‎src/core/qgsogcutils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,7 @@ QDomElement QgsOgcUtils::geometryToGML( const QgsGeometry &geometry, QDomDocumen
11351135
const QString &gmlIdBase,
11361136
int precision )
11371137
{
1138-
if ( !geometry )
1138+
if ( geometry.isNull() )
11391139
return QDomElement();
11401140

11411141
// coordinate separator

‎src/core/qgspallabeling.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,7 +1567,7 @@ void QgsPalLayerSettings::registerFeature( QgsFeature &f, QgsRenderContext &cont
15671567
}
15681568

15691569
geos::unique_ptr geosObstacleGeomClone;
1570-
if ( obstacleGeometry )
1570+
if ( !obstacleGeometry.isNull() )
15711571
{
15721572
geosObstacleGeomClone = QgsGeos::asGeos( obstacleGeometry );
15731573
}
@@ -2000,7 +2000,7 @@ void QgsPalLayerSettings::registerObstacleFeature( QgsFeature &f, QgsRenderConte
20002000
mCurFeat = &f;
20012001

20022002
QgsGeometry geom;
2003-
if ( obstacleGeometry )
2003+
if ( !obstacleGeometry.isNull() )
20042004
{
20052005
geom = obstacleGeometry;
20062006
}

0 commit comments

Comments
 (0)
Please sign in to comment.