Skip to content

Commit 92f2069

Browse files
Warr1024Zeno-
authored andcommittedApr 2, 2015
Fix crash caused by null texture in GUI formspec/HUD.
1 parent 58d62ad commit 92f2069

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed
 

Diff for: ‎src/guiscalingfilter.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ video::ITexture *guiScalingResizeCached(video::IVideoDriver *driver,
7272
video::ITexture *src, const core::rect<s32> &srcrect,
7373
const core::rect<s32> &destrect)
7474
{
75-
75+
if (src == NULL)
76+
return src;
7677
if (!g_settings->getBool("gui_scaling_filter"))
7778
return src;
7879

@@ -139,6 +140,8 @@ video::ITexture *guiScalingResizeCached(video::IVideoDriver *driver,
139140
video::ITexture *guiScalingImageButton(video::IVideoDriver *driver,
140141
video::ITexture *src, s32 width, s32 height)
141142
{
143+
if (src == NULL)
144+
return src;
142145
return guiScalingResizeCached(driver, src,
143146
core::rect<s32>(0, 0, src->getSize().Width, src->getSize().Height),
144147
core::rect<s32>(0, 0, width, height));
@@ -154,6 +157,8 @@ void draw2DImageFilterScaled(video::IVideoDriver *driver, video::ITexture *txr,
154157
{
155158
// Attempt to pre-scale image in software in high quality.
156159
video::ITexture *scaled = guiScalingResizeCached(driver, txr, srcrect, destrect);
160+
if (scaled == NULL)
161+
return;
157162

158163
// Correct source rect based on scaled image.
159164
const core::rect<s32> mysrcrect = (scaled != txr)

0 commit comments

Comments
 (0)
Please sign in to comment.