Added handling of null malloc

This commit is contained in:
Robert Osfield
2016-06-27 15:22:55 +01:00
parent fbb42e0388
commit 20866b8faa

View File

@@ -146,6 +146,11 @@ unsigned char *exr_load(std::istream& fin,
unsigned dataSize = (sizeof(half) * height * width * numComponents);
//buffer = new unsigned char[dataSize];
buffer = (unsigned char*)malloc(dataSize);
if (!buffer)
{
OSG_WARN<<"Warning: exr_load() out of memory"<<std::endl;
return 0;
}
half* pOut = (half*) buffer;
for (long i = height-1; i >= 0; i--)