diff --git a/src/engine/client/graphics_threaded.cpp b/src/engine/client/graphics_threaded.cpp index efe7ff03d72..3806d15decc 100644 --- a/src/engine/client/graphics_threaded.cpp +++ b/src/engine/client/graphics_threaded.cpp @@ -330,6 +330,9 @@ static bool ConvertToRGBA(uint8_t *pDest, const uint8_t *pSrc, size_t SrcWidth, int CGraphics_Threaded::LoadTextureRawSub(CTextureHandle TextureID, int x, int y, int Width, int Height, int Format, const void *pData) { + dbg_assert(Width > 0, "LoadTextureRawSub: Width is negative or zero"); + dbg_assert(Height > 0, "LoadTextureRawSub: Height is negative or zero"); + CCommandBuffer::SCommand_Texture_Update Cmd; Cmd.m_Slot = TextureID.Id(); Cmd.m_X = x; @@ -421,6 +424,9 @@ bool CGraphics_Threaded::IsSpriteTextureFullyTransparent(CImageInfo &FromImageIn IGraphics::CTextureHandle CGraphics_Threaded::LoadTextureRaw(int Width, int Height, int Format, const void *pData, int StoreFormat, int Flags, const char *pTexName) { + dbg_assert(Width > 0, "LoadTextureRaw: Width is negative or zero"); + dbg_assert(Height > 0, "LoadTextureRaw: Height is negative or zero"); + // don't waste memory on texture if we are stress testing #ifdef CONF_DEBUG if(g_Config.m_DbgStress && m_InvalidTexture.IsValid()) @@ -533,6 +539,9 @@ IGraphics::CTextureHandle CGraphics_Threaded::InvalidTexture() const bool CGraphics_Threaded::LoadTextTextures(int Width, int Height, CTextureHandle &TextTexture, CTextureHandle &TextOutlineTexture, void *pTextData, void *pTextOutlineData) { + dbg_assert(Width > 0, "LoadTextTextures: Width is negative or zero"); + dbg_assert(Height > 0, "LoadTextTextures: Height is negative or zero"); + if(Width == 0 || Height == 0) return false; @@ -608,6 +617,9 @@ bool CGraphics_Threaded::UnloadTextTextures(CTextureHandle &TextTexture, CTextur bool CGraphics_Threaded::UpdateTextTexture(CTextureHandle TextureID, int x, int y, int Width, int Height, const void *pData) { + dbg_assert(Width > 0, "UpdateTextTexture: Width is negative or zero"); + dbg_assert(Height > 0, "UpdateTextTexture: Height is negative or zero"); + CCommandBuffer::SCommand_TextTexture_Update Cmd; Cmd.m_Slot = TextureID.Id(); Cmd.m_X = x;