summaryrefslogtreecommitdiff
path: root/servers/visual/visual_server_canvas.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'servers/visual/visual_server_canvas.cpp')
-rw-r--r--servers/visual/visual_server_canvas.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/servers/visual/visual_server_canvas.cpp b/servers/visual/visual_server_canvas.cpp
index 13517fa409..931e084246 100644
--- a/servers/visual/visual_server_canvas.cpp
+++ b/servers/visual/visual_server_canvas.cpp
@@ -1099,13 +1099,15 @@ void VisualServerCanvas::canvas_light_occluder_set_polygon(RID p_occluder, RID p
if (occluder->polygon.is_valid()) {
LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.get(p_polygon);
- if (!occluder_poly)
+ if (!occluder_poly) {
occluder->polygon = RID();
- ERR_FAIL_COND(!occluder_poly);
- occluder_poly->owners.insert(occluder);
- occluder->polygon_buffer = occluder_poly->occluder;
- occluder->aabb_cache = occluder_poly->aabb;
- occluder->cull_cache = occluder_poly->cull_mode;
+ ERR_FAIL_COND(!occluder_poly);
+ } else {
+ occluder_poly->owners.insert(occluder);
+ occluder->polygon_buffer = occluder_poly->occluder;
+ occluder->aabb_cache = occluder_poly->aabb;
+ occluder->cull_cache = occluder_poly->cull_mode;
+ }
}
}
void VisualServerCanvas::canvas_light_occluder_set_transform(RID p_occluder, const Transform2D &p_xform) {