Browse Source

Fix crash on canvas with BG_MODE_KEEP, closes #19590

Juan Linietsky 6 years ago
parent
commit
d5ad1ca1ae
1 changed files with 3 additions and 1 deletions
  1. 3 1
      drivers/gles3/rasterizer_scene_gles3.cpp

+ 3 - 1
drivers/gles3/rasterizer_scene_gles3.cpp

@@ -4297,8 +4297,10 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
 		glClearBufferfv(GL_COLOR, 0, clear_color.components); // specular
 		glClearBufferfv(GL_COLOR, 0, clear_color.components); // specular
 	}
 	}
 
 
+	VS::EnvironmentBG bg_mode = (!env || (probe && env->bg_mode == VS::ENV_BG_CANVAS)) ? VS::ENV_BG_CLEAR_COLOR : env->bg_mode;
+
 	if (env) {
 	if (env) {
-		switch (env->bg_mode) {
+		switch (bg_mode) {
 			case VS::ENV_BG_COLOR_SKY:
 			case VS::ENV_BG_COLOR_SKY:
 			case VS::ENV_BG_SKY:
 			case VS::ENV_BG_SKY: