summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-11-16 14:11:14 +0100
committerGitHub <noreply@github.com>2021-11-16 14:11:14 +0100
commitb99792b5d9e85169b82127efe2ade563cc363b27 (patch)
treee3faa01593bf1fe9ee556fd8f62ff921aa49f473
parent471e7cbfc7d83220e45c16c7336214991ebc5515 (diff)
parenteb2deabffe7cea3f584ce152781445714cda0ff9 (diff)
Merge pull request #54167 from brunosxs/fix-game-crash-when-sending-a-notification-from-a-camera-class
-rw-r--r--scene/2d/camera_2d.cpp1
-rw-r--r--scene/main/canvas_item.cpp1
2 files changed, 2 insertions, 0 deletions
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp
index b4ee85120e..bf5671be19 100644
--- a/scene/2d/camera_2d.cpp
+++ b/scene/2d/camera_2d.cpp
@@ -232,6 +232,7 @@ void Camera2D::_notification(int p_what) {
} break;
case NOTIFICATION_ENTER_TREE: {
+ ERR_FAIL_COND(!is_inside_tree());
if (custom_viewport && ObjectDB::get_instance(custom_viewport_id)) {
viewport = custom_viewport;
} else {
diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp
index 5065684839..22e3c3bf24 100644
--- a/scene/main/canvas_item.cpp
+++ b/scene/main/canvas_item.cpp
@@ -274,6 +274,7 @@ void CanvasItem::_exit_canvas() {
void CanvasItem::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
+ ERR_FAIL_COND(!is_inside_tree());
_update_texture_filter_changed(false);
_update_texture_repeat_changed(false);