Skip to content

Commit

Permalink
Fix unexpected crashes in notification
Browse files Browse the repository at this point in the history
(cherry picked from commit 924c207)
  • Loading branch information
zaevi authored and akien-mga committed Oct 25, 2021
1 parent d09b33d commit a1b282c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions scene/2d/collision_polygon_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ void CollisionPolygon2D::_notification(int p_what) {
} break;

case NOTIFICATION_DRAW: {
ERR_FAIL_COND(!is_inside_tree());
if (!Engine::get_singleton()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) {
break;
}
Expand Down
2 changes: 2 additions & 0 deletions scene/2d/collision_shape_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ void CollisionShape2D::_notification(int p_what) {

} break;
case NOTIFICATION_DRAW: {
ERR_FAIL_COND(!is_inside_tree());

if (!Engine::get_singleton()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) {
break;
}
Expand Down
1 change: 1 addition & 0 deletions scene/2d/ray_cast_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ void RayCast2D::_notification(int p_what) {
} break;

case NOTIFICATION_DRAW: {
ERR_FAIL_COND(!is_inside_tree());
if (!Engine::get_singleton()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) {
break;
}
Expand Down

0 comments on commit a1b282c

Please sign in to comment.