mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-26 16:43:55 -07:00
check for null zone during card item teardown (#6149)
* check for null zone during card item teardown Took 1 hour 32 minutes Took 24 seconds * Also check for it in the successful branch. Took 6 minutes * Comment. Took 5 minutes --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
190ab211e3
commit
9c3be1b851
1 changed files with 17 additions and 5 deletions
|
|
@ -185,13 +185,25 @@ 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 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) {
|
||||
deleteLater();
|
||||
} else {
|
||||
emit attachedTo->zone->cardAdded(this);
|
||||
attachedTo->addAttachedCard(this);
|
||||
if (zone != attachedTo->getZone()) {
|
||||
attachedTo->getZone()->reorganizeCards();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
emit zone->cardAdded(this);
|
||||
// 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 (zone == nullptr) {
|
||||
deleteLater();
|
||||
} else {
|
||||
emit zone->cardAdded(this);
|
||||
}
|
||||
}
|
||||
|
||||
if (zone != nullptr) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue