diff --git a/src/core/geometry/qgsgeometrycollectionv2.cpp b/src/core/geometry/qgsgeometrycollectionv2.cpp index 5566297dd7ed..7e4ba52a515c 100644 --- a/src/core/geometry/qgsgeometrycollectionv2.cpp +++ b/src/core/geometry/qgsgeometrycollectionv2.cpp @@ -82,20 +82,12 @@ int QgsGeometryCollectionV2::numGeometries() const const QgsAbstractGeometryV2* QgsGeometryCollectionV2::geometryN( int n ) const { - if ( n >= mGeometries.size() ) - { - return nullptr; - } - return mGeometries.at( n ); + return mGeometries.value( n ); } QgsAbstractGeometryV2* QgsGeometryCollectionV2::geometryN( int n ) { - if ( n < 0 || n >= mGeometries.size() ) - { - return nullptr; - } - return mGeometries.at( n ); + return mGeometries.value( n ); } bool QgsGeometryCollectionV2::addGeometry( QgsAbstractGeometryV2* g )