1
0
Fork 0

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:
BrunoSXS 2021-10-23 17:30:18 -03:00 committed by Rémi Verschelde
parent 9a181edd87
commit 8fd0fe3d20
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 2 additions and 0 deletions

View File

@ -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();

View File

@ -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());