don't try to send events if the deck has been freed

This commit is contained in:
Lera Elvoé 2024-05-24 16:14:17 +03:00
parent db590acdb9
commit cb1e30d6af
No known key found for this signature in database

View file

@ -296,14 +296,23 @@ static func pre_exit_cleanup() -> void:
static func send_event(event_name: StringName, event_data: Dictionary = {}) -> void:
for deck_id: String in decks:
if decks[deck_id] is Deck:
(decks[deck_id] as Deck).send_event(event_name, event_data)
var deck: Deck = (decks[deck_id] as Deck)
if not is_instance_valid(deck):
continue
deck.send_event(event_name, event_data)
else:
for deck_instance_id: String in decks[deck_id]:
(decks[deck_id][deck_instance_id] as Deck).send_event(event_name, event_data)
var deck: Deck = (decks[deck_id][deck_instance_id] as Deck)
if not is_instance_valid(deck):
continue
deck.send_event(event_name, event_data)
for lib_group_id: String in lib_groups:
for lib_instance_id: String in lib_groups[lib_group_id]:
(lib_groups[lib_group_id][lib_instance_id] as Deck).send_event(event_name, event_data)
var deck: Deck = (lib_groups[lib_group_id][lib_instance_id] as Deck)
if not is_instance_valid(deck):
continue
deck.send_event(event_name, event_data)
#region group signal callbacks