(cherry picked from commit eb2deabffe7cea3f584ce152781445714cda0ff9)
@@ -245,6 +245,7 @@ void Camera2D::_notification(int p_what) {
} break;
case NOTIFICATION_ENTER_TREE: {
+ ERR_FAIL_COND(!is_inside_tree());
canvas = get_canvas();
_setup_viewport();
@@ -554,6 +554,7 @@ void CanvasItem::_exit_canvas() {
void CanvasItem::_notification(int p_what) {
switch (p_what) {
first_draw = true;
if (get_parent()) {
CanvasItem *ci = Object::cast_to<CanvasItem>(get_parent());