Skip to content

Commit bbf0c08

Browse files
committed
Fix crash if colour for pallette is out of range
1 parent c4fa82e commit bbf0c08

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/core/raster/qgspalettedrasterrenderer.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,14 @@ void * QgsPalettedRasterRenderer::readBlock( int bandNo, QgsRectangle const & e
138138
}
139139
if ( !hasTransparency )
140140
{
141-
imageScanLine[j] = mColors[ val ].rgba();
141+
if ( val < 0 || val > mNColors )
142+
{
143+
imageScanLine[j] = myDefaultColor;
144+
}
145+
else
146+
{
147+
imageScanLine[j] = mColors[ val ].rgba();
148+
}
142149
}
143150
else
144151
{

0 commit comments

Comments
 (0)