Skip to content

Commit 9d0193c

Browse files
committed
Merge pull request #19 from dahlheim/fix-source-edit
Fix error when setting unset field in source panel
2 parents 5ce5e12 + 1fe684c commit 9d0193c

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

CHANGELOG

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
[master]
2-
- Make (un)abbreviating journal titles also work on the journaltitle field
32
- Change default behaviour to be more non-invasive: timestamps and owners are NOT set by default per entry.
43
- "Open Folder" works again
54
- newline separator can now be configured globally
@@ -13,6 +12,8 @@
1312
- Fixes bug 880 "PubMed Import broken" (pull request #11 by vegeziel)
1413
- Fixes bug #959 "StringIndexOutOfBoundsException with invalid Preview text" (pull request #13 by IngvarJackal)
1514
- Fixes bug #960 "FileNotFoundException in Journal abbreviations window" (pull request #13 by IngvarJackal)
15+
- Make (un)abbreviating journal titles also work on the journaltitle field
16+
- Fix error when setting a previously unset field via the source panel of the entry editor
1617
2.10
1718
- Made IEEEXploreFetcher author parsing work again.
1819
- Added a few more characters in the HTML/Unicode to LaTeX conversion.

src/main/java/net/sf/jabref/EntryEditor.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -840,15 +840,14 @@ public boolean storeSource(boolean showError) {
840840

841841
// Then set all fields that have been set by the user.
842842
for (String field : nu.getAllFields()){
843-
if (!entry.getField(field).equals(nu.getField(field))) {
844-
String toSet = nu.getField(field);
845-
843+
String oldValue = entry.getField(field);
844+
String newValue = nu.getField(field);
845+
if (oldValue == null || !oldValue.equals(newValue)) {
846846
// Test if the field is legally set.
847-
(new LatexFieldFormatter()).format(toSet, field);
847+
(new LatexFieldFormatter()).format(newValue, field);
848848

849-
compound.addEdit(new UndoableFieldChange(entry, field, entry
850-
.getField(field), toSet));
851-
entry.setField(field, toSet);
849+
compound.addEdit(new UndoableFieldChange(entry, field, oldValue, newValue));
850+
entry.setField(field, newValue);
852851
anyChanged = true;
853852
}
854853
}

0 commit comments

Comments
 (0)