Graphics/GuillotineTextureAtlas: Handle texture instantiation failure (happens if size is too big)

This commit is contained in:
Jérôme Leclercq 2021-09-21 17:40:43 +02:00
parent 7ab4d91900
commit aa2021dc49
1 changed files with 9 additions and 2 deletions

View File

@ -42,9 +42,16 @@ namespace Nz
textureInfo.pixelFormat = PixelFormat::A8;
textureInfo.type = ImageType::E2D;
std::shared_ptr<Texture> newTexture = m_renderDevice.InstantiateTexture(textureInfo);
if (!newTexture)
std::shared_ptr<Texture> newTexture;
try
{
newTexture = m_renderDevice.InstantiateTexture(textureInfo);
}
catch (const std::exception& e)
{
NazaraError(std::string("Failed to instantiate texture: ") + e.what());
return nullptr;
}
if (oldImage)
{