summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-04-07 22:30:36 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-04-07 22:30:36 -0300
commit54ed432913fe07c0529dcf4aa13c50e1446e5689 (patch)
treec500b27b768d74cee909aecb2f50c0847f37e3da
parent7852be816a63d022c033bdaf76d0a7706630edd1 (diff)
fix crash when deleting shader from material, fixes #1631
-rw-r--r--scene/resources/material.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index 633dd72ce3..5d46605d6d 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -534,7 +534,7 @@ void ShaderMaterial::set_shader(const Ref<Shader>& p_shader) {
if (shader.is_valid())
shader->disconnect(SceneStringNames::get_singleton()->changed,this,SceneStringNames::get_singleton()->_shader_changed);
shader=p_shader;
- VS::get_singleton()->material_set_shader(material,shader->get_rid());
+ VS::get_singleton()->material_set_shader(material,shader.is_valid()?shader->get_rid():RID());
if (shader.is_valid()) {
shader->connect(SceneStringNames::get_singleton()->changed,this,SceneStringNames::get_singleton()->_shader_changed);
}