aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Suen <warr1024@gmail.com>2015-04-02 08:58:18 -0400
committerCraig Robbins <kde.psych@gmail.com>2015-04-02 23:56:46 +1000
commit92f20696eb57701d4d59adb5e9278315c2558180 (patch)
tree831ebb39593e10255c2cbbb70de1a2cf691b97c0
parent58d62ad04556de37f7870048f0f07aaa3ee0cd13 (diff)
downloadminetest-92f20696eb57701d4d59adb5e9278315c2558180.tar.gz
minetest-92f20696eb57701d4d59adb5e9278315c2558180.tar.bz2
minetest-92f20696eb57701d4d59adb5e9278315c2558180.zip
Fix crash caused by null texture in GUI formspec/HUD.
-rw-r--r--src/guiscalingfilter.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/guiscalingfilter.cpp b/src/guiscalingfilter.cpp
index 33e0648ad..26a2265a8 100644
--- a/src/guiscalingfilter.cpp
+++ b/src/guiscalingfilter.cpp
@@ -72,7 +72,8 @@ video::ITexture *guiScalingResizeCached(video::IVideoDriver *driver,
video::ITexture *src, const core::rect<s32> &srcrect,
const core::rect<s32> &destrect)
{
-
+ if (src == NULL)
+ return src;
if (!g_settings->getBool("gui_scaling_filter"))
return src;
@@ -139,6 +140,8 @@ video::ITexture *guiScalingResizeCached(video::IVideoDriver *driver,
video::ITexture *guiScalingImageButton(video::IVideoDriver *driver,
video::ITexture *src, s32 width, s32 height)
{
+ if (src == NULL)
+ return src;
return guiScalingResizeCached(driver, src,
core::rect<s32>(0, 0, src->getSize().Width, src->getSize().Height),
core::rect<s32>(0, 0, width, height));
@@ -154,6 +157,8 @@ void draw2DImageFilterScaled(video::IVideoDriver *driver, video::ITexture *txr,
{
// Attempt to pre-scale image in software in high quality.
video::ITexture *scaled = guiScalingResizeCached(driver, txr, srcrect, destrect);
+ if (scaled == NULL)
+ return;
// Correct source rect based on scaled image.
const core::rect<s32> mysrcrect = (scaled != txr)