Skip to content
Permalink
Browse files

skip null values in min/max check

git-svn-id: http://svn.osgeo.org/qgis/trunk@5162 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek
rblazek committed Apr 4, 2006
1 parent 88db7f4 commit fa0fae63e10b212283e568e4796ba2ca462ee7db
Showing with 18 additions and 16 deletions.
  1. +18 −16 src/providers/grass/qgsgrassprovider.cpp
@@ -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++;
}

0 comments on commit fa0fae6

Please sign in to comment.
You can’t perform that action at this time.