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
1 changed files with 5 additions and 0 deletions

View File

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