Also check for it in the successful branch.

Took 6 minutes
This commit is contained in:
Lukas Brübach 2025-09-15 18:54:38 +02:00
parent 184901c19c
commit df6143c03a

View file

@ -185,10 +185,14 @@ void CardItem::setAttachedTo(CardItem *_attachedTo)
gridPoint.setX(-1);
attachedTo = _attachedTo;
if (attachedTo != nullptr) {
emit attachedTo->zone->cardAdded(this);
attachedTo->addAttachedCard(this);
if (zone != attachedTo->getZone()) {
attachedTo->getZone()->reorganizeCards();
if (attachedTo->zone == nullptr) {
deleteLater();
} else {
emit attachedTo->zone->cardAdded(this);
attachedTo->addAttachedCard(this);
if (zone != attachedTo->getZone()) {
attachedTo->getZone()->reorganizeCards();
}
}
} else {
// If the zone is being torn down, it might already be null by the time a card tries to re-attach all its