aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2021-02-14 11:28:02 +0100
committersfan5 <sfan5@live.de>2021-02-14 11:28:02 +0100
commitf018737b0646e0961a46a74765945d6039e47b88 (patch)
treeeca346a9a9d49a37005ebd461ccd55636fe4fccb /src
parent375bcd65c1903957e3a640cefffcc8df164b78bd (diff)
downloadminetest-f018737b0646e0961a46a74765945d6039e47b88.tar.gz
minetest-f018737b0646e0961a46a74765945d6039e47b88.tar.bz2
minetest-f018737b0646e0961a46a74765945d6039e47b88.zip
Fix segfault with invalid texture strings and minimap enabled
closes #10949
Diffstat (limited to 'src')
-rw-r--r--src/client/tile.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/client/tile.cpp b/src/client/tile.cpp
index aad956ada..f2639757e 100644
--- a/src/client/tile.cpp
+++ b/src/client/tile.cpp
@@ -2224,9 +2224,14 @@ video::SColor TextureSource::getTextureAverageColor(const std::string &name)
video::IVideoDriver *driver = RenderingEngine::get_video_driver();
video::SColor c(0, 0, 0, 0);
video::ITexture *texture = getTexture(name);
+ if (!texture)
+ return c;
video::IImage *image = driver->createImage(texture,
core::position2d<s32>(0, 0),
texture->getOriginalSize());
+ if (!image)
+ return c;
+
u32 total = 0;
u32 tR = 0;
u32 tG = 0;