[VDE] Fix right click to remove card not working (#6549)

* fix typo

* fix crash
This commit is contained in:
RickyRister 2026-01-23 00:18:05 -08:00 committed by GitHub
parent 8d274c1924
commit 999733fc0f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -201,17 +201,19 @@ QModelIndex DeckStateManager::decrementCard(const ExactCard &card, const QString
return {}; return {};
} }
bool success = offsetCountAtIndex(idx, false); bool success = offsetCountAtIndex(idx, -1);
if (!success) { if (!success) {
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,