Skip to content

Commit 922776b

Browse files
committed
[afs] Fix crash when requesting invalid feature ID
1 parent 87207dd commit 922776b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/providers/arcgisrest/qgsafsshareddata.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,15 @@ bool QgsAfsSharedData::getFeature( QgsFeatureId id, QgsFeature &f, const QgsRect
5252
objectIds.reserve( stopId );
5353
for ( int i = startId; i < stopId; ++i )
5454
{
55-
objectIds.append( mObjectIds[i] );
55+
if ( i >= 0 && i < mObjectIds.count() )
56+
objectIds.append( mObjectIds[i] );
5657
}
5758

59+
if ( objectIds.empty() )
60+
{
61+
QgsDebugMsg( "No valid features IDs to fetch" );
62+
return false;
63+
}
5864

5965
// Query
6066
QString errorTitle, errorMessage;

0 commit comments

Comments
 (0)