Skip to content

Commit

Permalink
Fix updateNoteFields ArrayIndexOutOfBoundsException (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZXY101 authored Jul 13, 2024
1 parent a374ed6 commit a075592
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,12 @@ public void updateNoteFields(long note_id, Map<String, String> newFields, ArrayL
if (newValue != null) {
// Update field to new value
cardFields.put(fieldName, newValue);
} else {
// Ankidroids `getFields` won't return empty fields that are at the end of the array
// so `originalFields` may potentially contain less fields than `modelFieldNames`
} else if (originalFields.length >= i + 1) {
cardFields.put(fieldName, originalFields[i]);
} else {
cardFields.put(fieldName, "");
}
}

Expand Down

0 comments on commit a075592

Please sign in to comment.