From 24c8c121a5acea82c4457b8946f07fc351c5e0f7 Mon Sep 17 00:00:00 2001 From: Relintai Date: Fri, 18 Mar 2022 02:22:23 +0100 Subject: [PATCH] Check if aura is valid in AuraData's _to_dict. --- modules/entity_spell_system/entities/auras/aura_data.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/entity_spell_system/entities/auras/aura_data.cpp b/modules/entity_spell_system/entities/auras/aura_data.cpp index 634a9e881..d0d06c0f4 100644 --- a/modules/entity_spell_system/entities/auras/aura_data.cpp +++ b/modules/entity_spell_system/entities/auras/aura_data.cpp @@ -284,14 +284,18 @@ void AuraData::from_dict(const Dictionary &dict) { Dictionary AuraData::_to_dict() { Dictionary dict; - dict["aura_id"] = _aura_id; + if (_aura.is_valid()) { + dict["aura_id"] = _aura->get_id(); + } else { + dict["aura_id"] = _aura_id; + } + dict["aura_path"] = _aura_path; dict["remaining_time"] = _remaining_time; dict["caster_path"] = _caster_path; dict["spell_scale"] = _spell_scale; dict["aura_group"] = _aura_group; - dict["aura_id"] = _aura->get_id(); dict["is_timed"] = _is_timed; dict["damage"] = _damage;