From b31943574311c689e34a51c096de78ab1d0bc204 Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Tue, 15 Dec 2015 17:07:57 +0100 Subject: [PATCH] Simplify and harden code for geometry collections --- src/core/geometry/qgsgeometrycollectionv2.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) 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 )