Skip to content

Commit e02459c

Browse files
committedJun 19, 2013
Merge feature attributes: Return NULL if unable to calculate
1 parent 7d38eac commit e02459c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed
 

‎src/app/qgsmergeattributesdialog.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ QVariant QgsMergeAttributesDialog::minimumAttribute( int col )
327327

328328
if ( numberOfConsideredFeatures < 1 )
329329
{
330-
return QString();
330+
return QVariant( mVectorLayer->pendingFields()[col].type() );
331331
}
332332

333333
return QVariant( minimumValue );
@@ -377,6 +377,12 @@ QVariant QgsMergeAttributesDialog::meanAttribute( int col )
377377
++numberOfConsideredFeatures;
378378
}
379379
}
380+
381+
if ( numberOfConsideredFeatures < 1 )
382+
{
383+
return QVariant( mVectorLayer->pendingFields()[col].type() );
384+
}
385+
380386
double mean = sum / numberOfConsideredFeatures;
381387
return QVariant( mean );
382388
}
@@ -401,6 +407,13 @@ QVariant QgsMergeAttributesDialog::medianAttribute( int col )
401407

402408
double medianValue;
403409
int size = valueList.size();
410+
411+
412+
if ( size < 1 )
413+
{
414+
return QVariant( mVectorLayer->pendingFields()[col].type() );
415+
}
416+
404417
bool even = ( size % 2 ) < 1;
405418
if ( even )
406419
{

0 commit comments

Comments
 (0)
Please sign in to comment.