fix crash when deleting nested default deck
https://anki.tenderapp.com/discussions/ankidesktop/25777-bug-report-syn
This commit is contained in:
parent
baae899864
commit
0b3685193d
@ -153,8 +153,16 @@ class DeckManager:
|
||||
# child of an existing deck then it needs to be renamed
|
||||
deck = self.get(did)
|
||||
if '::' in deck['name']:
|
||||
deck['name'] = _("Default")
|
||||
self.save(deck)
|
||||
base = deck['name'].split("::")[-1]
|
||||
suffix = ""
|
||||
while True:
|
||||
# find an unused name
|
||||
name = base + suffix
|
||||
if not self.byName(name):
|
||||
deck['name'] = name
|
||||
self.save(deck)
|
||||
break
|
||||
suffix += "1"
|
||||
return
|
||||
# log the removal regardless of whether we have the deck or not
|
||||
self.col._logRem([did], REM_DECK)
|
||||
|
Loading…
Reference in New Issue
Block a user