Fixed crash when loading invalid texture.

This commit is contained in:
Branimir Karadžić 2015-05-27 21:18:43 -07:00
parent b5ea61856c
commit 00548b325a

View file

@ -176,6 +176,8 @@ bgfx::TextureHandle loadTexture(bx::FileReaderI* _reader, const char* _name, uin
BX_FREE(allocator, data); BX_FREE(allocator, data);
if (NULL != img)
{
handle = bgfx::createTexture2D(uint16_t(width), uint16_t(height), 1 handle = bgfx::createTexture2D(uint16_t(width), uint16_t(height), 1
, bgfx::TextureFormat::RGBA8 , bgfx::TextureFormat::RGBA8
, _flags , _flags
@ -196,6 +198,7 @@ bgfx::TextureHandle loadTexture(bx::FileReaderI* _reader, const char* _name, uin
); );
} }
} }
}
else else
{ {
DBG("Failed to load %s.", filePath); DBG("Failed to load %s.", filePath);