From: Aaron Suen Date: Thu, 2 Apr 2015 12:58:18 +0000 (-0400) Subject: Fix crash caused by null texture in GUI formspec/HUD. X-Git-Tag: 0.4.13~395 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=92f20696eb57701d4d59adb5e9278315c2558180;p=oweals%2Fminetest.git Fix crash caused by null texture in GUI formspec/HUD. --- 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 &srcrect, const core::rect &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(0, 0, src->getSize().Width, src->getSize().Height), core::rect(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 mysrcrect = (scaled != txr)