Added handling of possible zero divisor
This commit is contained in:
parent
1a10795198
commit
7f335fd528
@ -126,7 +126,8 @@ class ReaderWriterPNG : public osgDB::ReaderWriter
|
|||||||
}
|
}
|
||||||
|
|
||||||
//wish there was a Image::computeComponentSizeInBits()
|
//wish there was a Image::computeComponentSizeInBits()
|
||||||
bitDepth = Image::computePixelSizeInBits(img.getPixelFormat(),img.getDataType())/Image::computeNumComponents(img.getPixelFormat());
|
unsigned int numComponents = Image::computeNumComponents(img.getPixelFormat());
|
||||||
|
bitDepth = (numComponents>0) ? (Image::computePixelSizeInBits(img.getPixelFormat(),img.getDataType())/numComponents) : 0;
|
||||||
if(bitDepth!=8 && bitDepth!=16) return WriteResult::ERROR_IN_WRITING_FILE;
|
if(bitDepth!=8 && bitDepth!=16) return WriteResult::ERROR_IN_WRITING_FILE;
|
||||||
|
|
||||||
//Create row data
|
//Create row data
|
||||||
|
Loading…
Reference in New Issue
Block a user