diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-01-16 08:03:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-16 08:03:56 +0100 |
commit | 3af0400a32a2f81aad0b56940af0d6a92b6ffc92 (patch) | |
tree | cc25cc26cb20e863fe1142928eefab1a39b7244b | |
parent | bd1a8aacdae0cb1fd7044d6ff2cd7822b0e518a8 (diff) | |
parent | f1d0c391c76402aadb9561180669e236805b5741 (diff) |
Merge pull request #35176 from clayjohn/csg-crash
Fix light related crashes
-rw-r--r-- | drivers/gles2/rasterizer_scene_gles2.cpp | 2 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_scene_gles3.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp index 441e7e5c1a..6b1574bbbd 100644 --- a/drivers/gles2/rasterizer_scene_gles2.cpp +++ b/drivers/gles2/rasterizer_scene_gles2.cpp @@ -1169,7 +1169,7 @@ void RasterizerSceneGLES2::_add_geometry_with_material(RasterizerStorageGLES2::G LightInstance *li = light_instance_owner.getornull(e->instance->light_instances[i]); - if (li->light_index >= render_light_instance_count || render_light_instances[li->light_index] != li) { + if (!li || li->light_index >= render_light_instance_count || render_light_instances[li->light_index] != li) { continue; // too many or light_index did not correspond to the light instances to be rendered } diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 1be0c46668..03d5763299 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -1887,8 +1887,8 @@ void RasterizerSceneGLES3::_setup_light(RenderList::Element *e, const Transform const RID *lights = e->instance->light_instances.ptr(); for (int i = 0; i < lc; i++) { - LightInstance *li = light_instance_owner.getptr(lights[i]); - if (li->last_pass != render_pass) //not visible + LightInstance *li = light_instance_owner.getornull(lights[i]); + if (!li || li->last_pass != render_pass) //not visible continue; if (li && li->light_ptr->type == VS::LIGHT_OMNI) { |