fix possible crash when texture size is 0
This commit is contained in:
parent
8cfd37b6f5
commit
4247faa97c
3 changed files with 8 additions and 0 deletions
|
|
@ -50,11 +50,15 @@ ImTextureID FurnaceGUIRenderDX9::getTextureID(FurnaceGUITexture* which) {
|
|||
|
||||
float FurnaceGUIRenderDX9::getTextureU(FurnaceGUITexture* which) {
|
||||
FurnaceDX9Texture* t=(FurnaceDX9Texture*)which;
|
||||
if (which==NULL) return 0.0;
|
||||
if (t->widthReal<1) return 0.0f;
|
||||
return (float)t->width/(float)t->widthReal;
|
||||
}
|
||||
|
||||
float FurnaceGUIRenderDX9::getTextureV(FurnaceGUITexture* which) {
|
||||
FurnaceDX9Texture* t=(FurnaceDX9Texture*)which;
|
||||
if (which==NULL) return 0.0;
|
||||
if (t->heightReal<1) return 0.0f;
|
||||
return (float)t->height/(float)t->heightReal;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,11 +46,13 @@ ImTextureID FurnaceGUIRenderGL1::getTextureID(FurnaceGUITexture* which) {
|
|||
|
||||
float FurnaceGUIRenderGL1::getTextureU(FurnaceGUITexture* which) {
|
||||
FurnaceGL1Texture* t=(FurnaceGL1Texture*)which;
|
||||
if (t->widthReal<1) return 0.0f;
|
||||
return (float)t->width/(float)t->widthReal;
|
||||
}
|
||||
|
||||
float FurnaceGUIRenderGL1::getTextureV(FurnaceGUITexture* which) {
|
||||
FurnaceGL1Texture* t=(FurnaceGL1Texture*)which;
|
||||
if (t->heightReal<1) return 0.0f;
|
||||
return (float)t->height/(float)t->heightReal;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue