Skip to content

Commit f018737

Browse files
committedFeb 14, 2021
Fix segfault with invalid texture strings and minimap enabled
closes #10949
1 parent 375bcd6 commit f018737

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed
 

‎src/client/tile.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -2224,9 +2224,14 @@ video::SColor TextureSource::getTextureAverageColor(const std::string &name)
22242224
video::IVideoDriver *driver = RenderingEngine::get_video_driver();
22252225
video::SColor c(0, 0, 0, 0);
22262226
video::ITexture *texture = getTexture(name);
2227+
if (!texture)
2228+
return c;
22272229
video::IImage *image = driver->createImage(texture,
22282230
core::position2d<s32>(0, 0),
22292231
texture->getOriginalSize());
2232+
if (!image)
2233+
return c;
2234+
22302235
u32 total = 0;
22312236
u32 tR = 0;
22322237
u32 tG = 0;

0 commit comments

Comments
 (0)
Please sign in to comment.