summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Roubinsky <chaosus89@gmail.com>2022-01-04 08:56:33 +0300
committerYuri Roubinsky <chaosus89@gmail.com>2022-01-04 11:50:50 +0300
commit0e2ef987b18537a729cdbe42f2acd0a396c1abcd (patch)
treed6523368d5ff8159095900d9198eed5d70d56746
parent5cb6f39014a2c82f1aa3ed16509c91f444069521 (diff)
Add a check for device in shader lang to prevent startup editor crash
-rw-r--r--servers/rendering/shader_language.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp
index 4ac9d8db64..b0a705fc6b 100644
--- a/servers/rendering/shader_language.cpp
+++ b/servers/rendering/shader_language.cpp
@@ -7595,7 +7595,10 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
int instance_index = 0;
#ifdef DEBUG_ENABLED
int uniform_buffer_size = 0;
- int max_uniform_buffer_size = RenderingDevice::get_singleton()->limit_get(RenderingDevice::LIMIT_MAX_UNIFORM_BUFFER_SIZE);
+ int max_uniform_buffer_size = 0;
+ if (RenderingDevice::get_singleton()) {
+ max_uniform_buffer_size = RenderingDevice::get_singleton()->limit_get(RenderingDevice::LIMIT_MAX_UNIFORM_BUFFER_SIZE);
+ }
#endif // DEBUG_ENABLED
ShaderNode::Uniform::Scope uniform_scope = ShaderNode::Uniform::SCOPE_LOCAL;