Skip to content

Commit

Permalink
Fixed NullPointerException when trying to set a special field or mark…
Browse files Browse the repository at this point in the history
… an entry through the menu without having an open database
  • Loading branch information
oscargus committed Aug 10, 2016
1 parent 6b3b8fc commit d1721de
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- Fixed [#16682](https://github.com/JabRef/jabref/issues/1682): An entry now must have a BibTeX key to be cited in OpenOffice/LibreOffice
- Fixed NullPointerException when clicking OK without specifying a field name in set/clear/rename fields
- Fixed IndexOutOfBoundsException when trying to download a full text document without selecting an entry
- Fixed NullPointerException when trying to set a special field or mark an entry through the menu without having an open database


### Removed
Expand Down
24 changes: 13 additions & 11 deletions src/main/java/net/sf/jabref/gui/worker/MarkEntriesAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,20 @@ public void actionPerformed(ActionEvent actionEvent) {
@Override
public void run() {
BasePanel panel = frame.getCurrentBasePanel();
List<BibEntry> bes = panel.getSelectedEntries();

// used at update() to determine output string
besLength = bes.size();

if (!bes.isEmpty()) {
NamedCompound ce = new NamedCompound(Localization.lang("Mark entries"));
for (BibEntry be : bes) {
EntryMarker.markEntry(be, level + 1, false, ce);
if (panel != null) {
List<BibEntry> bes = panel.getSelectedEntries();

// used at update() to determine output string
besLength = bes.size();

if (!bes.isEmpty()) {
NamedCompound ce = new NamedCompound(Localization.lang("Mark entries"));
for (BibEntry be : bes) {
EntryMarker.markEntry(be, level + 1, false, ce);
}
ce.end();
panel.getUndoManager().addEdit(ce);
}
ce.end();
panel.getUndoManager().addEdit(ce);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public SpecialFieldMenuAction(SpecialFieldValue val, JabRefFrame frame) {

@Override
public void actionPerformed(ActionEvent evt) {
frame.getCurrentBasePanel().runCommand(actionName);
if (frame.getCurrentBasePanel() != null) {
frame.getCurrentBasePanel().runCommand(actionName);
}
}
}

0 comments on commit d1721de

Please sign in to comment.