From e68f04b9d07b6128eb05bc6ca042c986c6501e90 Mon Sep 17 00:00:00 2001 From: George Marques Date: Tue, 22 Sep 2015 20:27:48 -0300 Subject: Check if shape is valid before referencing it See the comment from @MartiniMoe at #2366. --- scene/2d/collision_shape_2d.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp index cd89e914fb..dbe9d7179c 100644 --- a/scene/2d/collision_shape_2d.cpp +++ b/scene/2d/collision_shape_2d.cpp @@ -117,6 +117,9 @@ void CollisionShape2D::_notification(int p_what) { Color draw_col=get_tree()->get_debug_collisions_color(); + if(!shape.is_valid()) { + break; + } shape->draw(get_canvas_item(),draw_col); -- cgit v1.2.3 From 5ff0b69dae55e35ef57277d32296effc9318213f Mon Sep 17 00:00:00 2001 From: George Marques Date: Tue, 22 Sep 2015 21:30:08 -0300 Subject: Move the shape test to a little sooner --- scene/2d/collision_shape_2d.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scene/2d/collision_shape_2d.cpp b/scene/2d/collision_shape_2d.cpp index dbe9d7179c..85751fc735 100644 --- a/scene/2d/collision_shape_2d.cpp +++ b/scene/2d/collision_shape_2d.cpp @@ -113,13 +113,14 @@ void CollisionShape2D::_notification(int p_what) { break; } + if (!shape.is_valid()) { + break; + } + rect=Rect2(); Color draw_col=get_tree()->get_debug_collisions_color(); - if(!shape.is_valid()) { - break; - } shape->draw(get_canvas_item(),draw_col); -- cgit v1.2.3