diff --git a/entities/auras/aura_data.cpp b/entities/auras/aura_data.cpp index b874134..8996f61 100644 --- a/entities/auras/aura_data.cpp +++ b/entities/auras/aura_data.cpp @@ -88,7 +88,9 @@ void AuraData::set_caster(Entity *value) { return; } - _caster_path = _caster->get_path(); + if (_caster->is_inside_tree()) { + _caster_path = _caster->get_path(); + } } void AuraData::set_caster_bind(Node *value) { diff --git a/infos/spell_cast_info.cpp b/infos/spell_cast_info.cpp index 3f0d2e5..1e76af6 100644 --- a/infos/spell_cast_info.cpp +++ b/infos/spell_cast_info.cpp @@ -148,8 +148,10 @@ void SpellCastInfo::from_dict(Node *owner, const Dictionary &dict) { ERR_FAIL_COND(!ObjectDB::instance_validate(owner)); ERR_FAIL_COND(dict.empty()); - _caster = Object::cast_to(owner->get_node_or_null(dict.get("caster", ""))); - _target = Object::cast_to(owner->get_node_or_null(dict.get("target", ""))); + if (owner->is_inside_tree()) { + _caster = Object::cast_to(owner->get_node_or_null(dict.get("caster", ""))); + _target = Object::cast_to(owner->get_node_or_null(dict.get("target", ""))); + } _has_cast_time = dict.get("has_cast_time", true); _cast_time = dict.get("cast_time", 0);