Tile: Fix segfault caused by invalid PNG data

This commit is contained in:
SmallJoker 2023-03-02 22:08:49 +01:00 committed by sfan5
parent e66e583f5e
commit 847ed04e0a

@ -1869,6 +1869,11 @@ bool TextureSource::generateImagePart(std::string part_of_name,
video::IImage* pngimg = vd->createImageFromFile(memfile); video::IImage* pngimg = vd->createImageFromFile(memfile);
memfile->drop(); memfile->drop();
if (!pngimg) {
errorstream << "generateImagePart(): Invalid PNG data" << std::endl;
return false;
}
if (baseimg) { if (baseimg) {
blitBaseImage(pngimg, baseimg); blitBaseImage(pngimg, baseimg);
} else { } else {