diff options
author | sfan5 <sfan5@live.de> | 2020-06-01 21:19:35 +0200 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2020-06-01 21:19:35 +0200 |
commit | 0e698e63b3bc27551fda9bd4e66f72501413b4e6 (patch) | |
tree | 0abea638a811d04d9cc8b6b16236683789aa8f47 /src | |
parent | 42a9b45c21ad407689950e3a4c90cb3894142260 (diff) | |
download | minetest-0e698e63b3bc27551fda9bd4e66f72501413b4e6.tar.gz minetest-0e698e63b3bc27551fda9bd4e66f72501413b4e6.tar.bz2 minetest-0e698e63b3bc27551fda9bd4e66f72501413b4e6.zip |
Fix autoscale_mode segfault if tile doesn't have texture
closes #9965
Diffstat (limited to 'src')
-rw-r--r-- | src/nodedef.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nodedef.cpp b/src/nodedef.cpp index cb841e544..a84338752 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -608,8 +608,9 @@ static void fillTileAttribs(ITextureSource *tsrc, TileLayer *layer, layer->material_type = material_type; bool has_scale = tiledef.scale > 0; - if (((tsettings.autoscale_mode == AUTOSCALE_ENABLE) && !has_scale) || - (tsettings.autoscale_mode == AUTOSCALE_FORCE)) { + bool use_autoscale = tsettings.autoscale_mode == AUTOSCALE_FORCE || + (tsettings.autoscale_mode == AUTOSCALE_ENABLE && !has_scale); + if (use_autoscale && layer->texture) { auto texture_size = layer->texture->getOriginalSize(); float base_size = tsettings.node_texture_size; float size = std::fmin(texture_size.Width, texture_size.Height); |