mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
Fixes a game crash caused by instantiating Camera2D and sending a notification from it before adding it to the tree.
(cherry picked from commit eb2deabffe)
This commit is contained in:
committed by
Rémi Verschelde
parent
9a181edd87
commit
8fd0fe3d20
@@ -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) {
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
ERR_FAIL_COND(!is_inside_tree());
|
||||
first_draw = true;
|
||||
if (get_parent()) {
|
||||
CanvasItem *ci = Object::cast_to<CanvasItem>(get_parent());
|
||||
|
||||
Reference in New Issue
Block a user