From aa2021dc492cba99c247bcaaad7df750c9543553 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Leclercq?= Date: Tue, 21 Sep 2021 17:40:43 +0200 Subject: [PATCH] Graphics/GuillotineTextureAtlas: Handle texture instantiation failure (happens if size is too big) --- src/Nazara/Graphics/GuillotineTextureAtlas.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Nazara/Graphics/GuillotineTextureAtlas.cpp b/src/Nazara/Graphics/GuillotineTextureAtlas.cpp index 4da4db68e..41e9d1fda 100644 --- a/src/Nazara/Graphics/GuillotineTextureAtlas.cpp +++ b/src/Nazara/Graphics/GuillotineTextureAtlas.cpp @@ -42,9 +42,16 @@ namespace Nz textureInfo.pixelFormat = PixelFormat::A8; textureInfo.type = ImageType::E2D; - std::shared_ptr newTexture = m_renderDevice.InstantiateTexture(textureInfo); - if (!newTexture) + std::shared_ptr 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) {