From c59cd92c12c0a04c6b772561acf4f2b652e0d6d3 Mon Sep 17 00:00:00 2001 From: Radim Blazek Date: Mon, 4 Nov 2013 08:26:42 +0100 Subject: [PATCH] Load raster category names fix --- src/providers/gdal/qgsgdalproviderbase.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/providers/gdal/qgsgdalproviderbase.cpp b/src/providers/gdal/qgsgdalproviderbase.cpp index 886d0d6ce20..16fbcaf1370 100644 --- a/src/providers/gdal/qgsgdalproviderbase.cpp +++ b/src/providers/gdal/qgsgdalproviderbase.cpp @@ -63,11 +63,14 @@ QList QgsGdalProviderBase::colorTable( GDALDa // load category labels char ** categoryNames = GDALGetRasterCategoryNames( myGdalBand ); QVector labels; - int i = 0; - while ( categoryNames[i] ) + if ( categoryNames ) { - labels.append( QString( categoryNames[i] ) ); - i++; + int i = 0; + while ( categoryNames[i] ) + { + labels.append( QString( categoryNames[i] ) ); + i++; + } } int myEntryCount = GDALGetColorEntryCount( myGdalColorTable );