From 5997c7dc4d36a642e01042c36e0ad04b770c4a32 Mon Sep 17 00:00:00 2001 From: Relintai Date: Thu, 17 Mar 2022 10:31:08 +0100 Subject: [PATCH] Null check the Prop2DCache sincgleton in Prop2DMesher's constructor. --- modules/props_2d/prop_2d_mesher.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/props_2d/prop_2d_mesher.cpp b/modules/props_2d/prop_2d_mesher.cpp index 8e8ef2787..e27ee85c3 100644 --- a/modules/props_2d/prop_2d_mesher.cpp +++ b/modules/props_2d/prop_2d_mesher.cpp @@ -25,9 +25,9 @@ SOFTWARE. #include "lights/prop_2d_light.h" #include "modules/opensimplex/open_simplex_noise.h" +#include "./singleton/prop_2d_cache.h" #include "material_cache/prop_2d_material_cache.h" #include "tiled_wall/tiled_wall_2d_data.h" -#include "./singleton/prop_2d_cache.h" const String Prop2DMesher::BINDING_STRING_BUILD_FLAGS = "Use Lighting,Use AO,Use RAO,Bake Lights"; @@ -1123,7 +1123,14 @@ Prop2DMesher::Prop2DMesher() { _uv_margin = Rect2(0, 0, 1, 1); _format = 0; _texture_scale = 1; - _pixels_per_unit = Prop2DCache::get_singleton()->get_default_pixels_per_unit(); + + if (Prop2DCache::get_singleton()) { + _pixels_per_unit = Prop2DCache::get_singleton()->get_default_pixels_per_unit(); + } else { + //Just fall back to the default. + //Note that this will be removed when I get to it, as it can be calculated. + _pixels_per_unit = 64; + } _build_flags = 0;