Fix possible NULL dereference in createExtrudedMesh
parent
922a30ee47
commit
3607fae75a
10
src/mesh.cpp
10
src/mesh.cpp
|
@ -280,16 +280,18 @@ scene::IAnimatedMesh* createExtrudedMesh(video::ITexture *texture,
|
||||||
|
|
||||||
// img1 is in the texture's color format, convert to 8-bit ARGB
|
// img1 is in the texture's color format, convert to 8-bit ARGB
|
||||||
video::IImage *img2 = driver->createImage(video::ECF_A8R8G8B8, size);
|
video::IImage *img2 = driver->createImage(video::ECF_A8R8G8B8, size);
|
||||||
if (img2 != NULL)
|
if (img2 == NULL)
|
||||||
{
|
{
|
||||||
img1->copyTo(img2);
|
img1->drop();
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
img1->copyTo(img2);
|
||||||
|
img1->drop();
|
||||||
mesh = extrudeARGB(size.Width, size.Height, (u8*) img2->lock());
|
mesh = extrudeARGB(size.Width, size.Height, (u8*) img2->lock());
|
||||||
img2->unlock();
|
img2->unlock();
|
||||||
img2->drop();
|
img2->drop();
|
||||||
}
|
}
|
||||||
img1->drop();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set default material
|
// Set default material
|
||||||
mesh->getMeshBuffer(0)->getMaterial().setTexture(0, texture);
|
mesh->getMeshBuffer(0)->getMaterial().setTexture(0, texture);
|
||||||
|
|
Loading…
Reference in New Issue