Graphics/GuillotineTextureAtlas: Handle texture instantiation failure (happens if size is too big)
This commit is contained in:
parent
7ab4d91900
commit
aa2021dc49
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue