Took 5 minutes
This commit is contained in:
Lukas Brübach 2025-09-15 18:59:31 +02:00
parent df6143c03a
commit 161661b781

View file

@ -185,6 +185,8 @@ void CardItem::setAttachedTo(CardItem *_attachedTo)
gridPoint.setX(-1); gridPoint.setX(-1);
attachedTo = _attachedTo; attachedTo = _attachedTo;
if (attachedTo != nullptr) { if (attachedTo != nullptr) {
// If the zone is being torn down, it might already be null by the time a card tries to un-attach all its
// attached cards
if (attachedTo->zone == nullptr) { if (attachedTo->zone == nullptr) {
deleteLater(); deleteLater();
} else { } else {
@ -195,7 +197,7 @@ void CardItem::setAttachedTo(CardItem *_attachedTo)
} }
} }
} else { } else {
// If the zone is being torn down, it might already be null by the time a card tries to re-attach all its // If the zone is being torn down, it might already be null by the time a card tries to un-attach all its
// attached cards // attached cards
if (zone == nullptr) { if (zone == nullptr) {
deleteLater(); deleteLater();