JPEG decoding crashes if HeapBlock fails to allocate enough memory. The HeapBlock doesn’t throw an exception, it just returns nullptr
.
Image::BitmapData.data
== nullptr and getLinePointer
returns null and then when it tries to write the image data it crashes.
Could you make it like this:
const Image::BitmapData destData (image, Image::BitmapData::writeOnly);
if (destData.data == nullptr)
return {};