Skip to content

Commit

Permalink
skip null values in min/max check
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5162 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek committed Apr 4, 2006
1 parent 4bcb313 commit 4050734
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions src/providers/grass/qgsgrassprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -886,22 +886,24 @@ void QgsGrassProvider::loadAttributes ( GLAYER &layer )
#endif

layer.attributes[layer.nAttributes].values[i] = strdup ( db_get_string(&dbstr) );

double dbl;
if ( ctype == DB_C_TYPE_INT ) {
dbl = db_get_value_int ( value );
} else if ( ctype == DB_C_TYPE_DOUBLE ) {
dbl = db_get_value_double ( value );
} else {
dbl = 0;
}

if ( dbl < layer.minmax[i][0] ) {
layer.minmax[i][0] = dbl;
}
if ( dbl > layer.minmax[i][1] ) {
layer.minmax[i][1] = dbl;
}
if ( !db_test_value_isnull(value) )
{
double dbl;
if ( ctype == DB_C_TYPE_INT ) {
dbl = db_get_value_int ( value );
} else if ( ctype == DB_C_TYPE_DOUBLE ) {
dbl = db_get_value_double ( value );
} else {
dbl = 0;
}

if ( dbl < layer.minmax[i][0] ) {
layer.minmax[i][0] = dbl;
}
if ( dbl > layer.minmax[i][1] ) {
layer.minmax[i][1] = dbl;
}
}
}
layer.nAttributes++;
}
Expand Down

0 comments on commit 4050734

Please sign in to comment.