mirror of
https://github.com/ankidroid/Anki-Android.git
synced 2024-09-20 12:02:16 +02:00
fix: moving to note type with fewer sticky fields
IndexOutOfBoundsException when moving from 'Basic (optional reversed card)' to 'Basic (and reversed card)' after setting 'Toggle Sticky' for all fields This is due to 'toggle sticky' being present, but the field not existing Fixes 13719 Quick fix to stop a crash. Needs more thought and testing
This commit is contained in:
parent
2ecaf6079a
commit
a0fe79cbae
@ -1432,9 +1432,15 @@ class NoteEditor : AnkiActivity(), DeckSelectionListener, SubtitleListener, Tags
|
||||
}
|
||||
}
|
||||
|
||||
@NeedsTest("13719: moving from a note type with more fields to one with fewer fields")
|
||||
private fun saveToggleStickyMap() {
|
||||
for ((key) in mToggleStickyText) {
|
||||
mToggleStickyText[key] = mEditFields!![key]!!.fieldText
|
||||
// handle fields for different note type with different size
|
||||
if (key < mEditFields!!.size) {
|
||||
mToggleStickyText[key] = mEditFields!![key]?.fieldText
|
||||
} else {
|
||||
mToggleStickyText.remove(key)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user