Graphics/GuillotineTextureAtlas: Handle texture instantiation failure (happens if size is too big)
This commit is contained in:
@@ -42,9 +42,16 @@ namespace Nz
|
|||||||
textureInfo.pixelFormat = PixelFormat::A8;
|
textureInfo.pixelFormat = PixelFormat::A8;
|
||||||
textureInfo.type = ImageType::E2D;
|
textureInfo.type = ImageType::E2D;
|
||||||
|
|
||||||
std::shared_ptr<Texture> newTexture = m_renderDevice.InstantiateTexture(textureInfo);
|
std::shared_ptr<Texture> newTexture;
|
||||||
if (!newTexture)
|
try
|
||||||
|
{
|
||||||
|
newTexture = m_renderDevice.InstantiateTexture(textureInfo);
|
||||||
|
}
|
||||||
|
catch (const std::exception& e)
|
||||||
|
{
|
||||||
|
NazaraError(std::string("Failed to instantiate texture: ") + e.what());
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
if (oldImage)
|
if (oldImage)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user