fix crash

This commit is contained in:
RickyRister 2026-01-22 18:42:12 -08:00
parent 07342f817d
commit 8a0b6761d5

View file

@ -207,11 +207,13 @@ QModelIndex DeckStateManager::decrementCard(const ExactCard &card, const QString
return {}; return {};
} }
if (idx.isValid()) { // old index is no longer safe since rows could have been removed
emit focusIndexChanged(idx, true); QModelIndex newIdx = deckListModel->findCard(card.getName(), zoneName, providerId, collectorNumber);
if (newIdx.isValid()) {
emit focusIndexChanged(newIdx, true);
} }
return idx; return newIdx;
} }
static bool doSwapCard(DeckListModel *model, static bool doSwapCard(DeckListModel *model,