File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -5412,16 +5412,37 @@ bool QgsRasterLayer::readFile( QString const &theFilename )
54125412 // we know we have at least 2 layers...
54135413 mRedBandName = bandName ( myQSettings.value ( " /Raster/defaultRedBand" , 1 ).toInt () ); // sensible default
54145414 mGreenBandName = bandName ( myQSettings.value ( " /Raster/defaultGreenBand" , 2 ).toInt () ); // sensible default
5415+
5416+ // Check to make sure preferred bands combinations are valid
5417+ if ( mRedBandName .isEmpty () )
5418+ {
5419+ mRedBandName = bandName ( 1 );
5420+ }
5421+
5422+ if ( mGreenBandName .isEmpty () )
5423+ {
5424+ mGreenBandName = bandName ( 2 );
5425+ }
5426+
54155427 // for the third layer we cant be sure so..
54165428 if ( GDALGetRasterCount ( mGdalDataset ) > 2 )
54175429 {
54185430 mBlueBandName = bandName ( myQSettings.value ( " /Raster/defaultBlueBand" , 3 ).toInt () ); // sensible default
5431+ if ( mBlueBandName .isEmpty () )
5432+ {
5433+ mBlueBandName = bandName ( 3 );
5434+ }
54195435 }
54205436 else
54215437 {
54225438 mBlueBandName = bandName ( myQSettings.value ( " /Raster/defaultBlueBand" , 2 ).toInt () ); // sensible default
5439+ if ( mBlueBandName .isEmpty () )
5440+ {
5441+ mBlueBandName = bandName ( 2 );
5442+ }
54235443 }
54245444
5445+
54255446 mTransparencyBandName = TRSTRING_NOT_SET;
54265447 mGrayBandName = TRSTRING_NOT_SET; // sensible default
54275448 mDrawingStyle = MultiBandColor; // sensible default
You can’t perform that action at this time.
0 commit comments