Merge pull request #10125 from marcelofg55/fixeditor_crash
Add missing NULL checks to prevent possible crashes on _add_geometry
This commit is contained in:
commit
ee7e649e69
|
@ -4621,6 +4621,7 @@ void RasterizerGLES2::_add_geometry(const Geometry *p_geometry, const InstanceDa
|
|||
if (duplicate) {
|
||||
|
||||
ec = render_list->add_element();
|
||||
if (ec)
|
||||
memcpy(ec, e, sizeof(RenderList::Element));
|
||||
} else {
|
||||
|
||||
|
@ -4628,10 +4629,12 @@ void RasterizerGLES2::_add_geometry(const Geometry *p_geometry, const InstanceDa
|
|||
duplicate = true;
|
||||
}
|
||||
|
||||
if (ec) {
|
||||
ec->light_type = light_type;
|
||||
ec->light = sort_key;
|
||||
ec->additive_ptr = &e->additive;
|
||||
}
|
||||
}
|
||||
|
||||
const RID *liptr = p_instance->light_instances.ptr();
|
||||
int ilc = p_instance->light_instances.size();
|
||||
|
@ -4651,18 +4654,20 @@ void RasterizerGLES2::_add_geometry(const Geometry *p_geometry, const InstanceDa
|
|||
if (duplicate) {
|
||||
|
||||
ec = render_list->add_element();
|
||||
if (ec)
|
||||
memcpy(ec, e, sizeof(RenderList::Element));
|
||||
} else {
|
||||
|
||||
duplicate = true;
|
||||
ec = e;
|
||||
}
|
||||
|
||||
if (ec) {
|
||||
ec->light_type = light_type;
|
||||
ec->light = sort_key;
|
||||
ec->additive_ptr = &e->additive;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_TEST_ERROR("Add Geometry");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue