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@5162 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek committed Apr 4, 2006
1 parent 88db7f4 commit fa0fae6
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions src/providers/grass/qgsgrassprovider.cpp
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 fa0fae6

Please sign in to comment.