Skip to content

Commit

Permalink
Fix autoscale_mode segfault if tile doesn't have texture
Browse files Browse the repository at this point in the history
closes #9965
  • Loading branch information
sfan5 committed Jun 1, 2020
1 parent 42a9b45 commit 0e698e6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/nodedef.cpp
Expand Up @@ -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);
Expand Down

0 comments on commit 0e698e6

Please sign in to comment.