Skip to content

Commit

Permalink
fix IndexOutOfBoundsException when saving preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
125m125 authored and tobiasdiez committed Oct 9, 2018
1 parent 0f838e3 commit 29838ee
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/main/java/org/jabref/gui/SaveOrderConfigDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.InternalBibtexFields;
import org.jabref.model.metadata.SaveOrderConfig;
import org.jabref.model.metadata.SaveOrderConfig.SortCriterion;

public class SaveOrderConfigDisplay {

Expand Down Expand Up @@ -85,12 +86,12 @@ public void setEnabled(boolean enabled) {

public SaveOrderConfig getSaveOrderConfig() {
SaveOrderConfig saveOrderConfig = new SaveOrderConfig();
saveOrderConfig.getSortCriteria().get(0).field = getSelectedItemAsLowerCaseTrim(savePriSort);
saveOrderConfig.getSortCriteria().get(0).descending = savePriDesc.isSelected();
saveOrderConfig.getSortCriteria().get(1).field = getSelectedItemAsLowerCaseTrim(saveSecSort);
saveOrderConfig.getSortCriteria().get(1).descending = saveSecDesc.isSelected();
saveOrderConfig.getSortCriteria().get(2).field = getSelectedItemAsLowerCaseTrim(saveTerSort);
saveOrderConfig.getSortCriteria().get(2).descending = saveTerDesc.isSelected();
SortCriterion primary = new SortCriterion(getSelectedItemAsLowerCaseTrim(savePriSort), savePriDesc.isSelected());
saveOrderConfig.getSortCriteria().add(primary);
SortCriterion secondary = new SortCriterion(getSelectedItemAsLowerCaseTrim(saveSecSort), saveSecDesc.isSelected());
saveOrderConfig.getSortCriteria().add(secondary);
SortCriterion tertiary = new SortCriterion(getSelectedItemAsLowerCaseTrim(saveTerSort), saveTerDesc.isSelected());
saveOrderConfig.getSortCriteria().add(tertiary);

return saveOrderConfig;
}
Expand Down

0 comments on commit 29838ee

Please sign in to comment.