Skip to content

Commit

Permalink
Make sure Texture is valid before setting size
Browse files Browse the repository at this point in the history
  • Loading branch information
marstaik committed Jul 20, 2020
1 parent e52460e commit aa11dc0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scene/resources/material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1597,7 +1597,7 @@ void BaseMaterial3D::set_texture(TextureParam p_param, const Ref<Texture2D> &p_t
textures[p_param] = p_texture;
RID rid = p_texture.is_valid() ? p_texture->get_rid() : RID();
RS::get_singleton()->material_set_param(_get_material(), shader_names->texture_names[p_param], rid);
if (p_param == TEXTURE_ALBEDO) {
if (p_texture.is_valid() && p_param == TEXTURE_ALBEDO) {
RS::get_singleton()->material_set_param(_get_material(), shader_names->albedo_texture_size,
Vector2i(p_texture->get_width(), p_texture->get_height()));
}
Expand Down

0 comments on commit aa11dc0

Please sign in to comment.