From f018737b0646e0961a46a74765945d6039e47b88 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sun, 14 Feb 2021 11:28:02 +0100 Subject: Fix segfault with invalid texture strings and minimap enabled closes #10949 --- src/client/tile.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') 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(0, 0), texture->getOriginalSize()); + if (!image) + return c; + u32 total = 0; u32 tR = 0; u32 tG = 0; -- cgit v1.2.3