Skip to content

Commit

Permalink
Fix exception when adding new entry
Browse files Browse the repository at this point in the history
  • Loading branch information
Siedlerchr committed Aug 23, 2019
1 parent 854cd51 commit 6b97d67
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/main/java/org/jabref/gui/EntryTypeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.Collection;
import java.util.List;
import java.util.Optional;

import javafx.application.Platform;
import javafx.event.Event;
Expand Down Expand Up @@ -79,7 +80,7 @@ public EntryTypeView(BasePanel basePanel, DialogService dialogService, JabRefPre

EasyBind.subscribe(viewModel.searchSuccesfulProperty(), value -> {
if (value) {
setEntryTypeForReturnAndClose(null);
setEntryTypeForReturnAndClose(Optional.empty());
}
});

Expand All @@ -89,7 +90,7 @@ private void addEntriesToPane(FlowPane pane, Collection<? extends BibEntryType>
for (BibEntryType entryType : entries) {
Button entryButton = new Button(entryType.getType().getDisplayName());
entryButton.setUserData(entryType);
entryButton.setOnAction(event -> setEntryTypeForReturnAndClose(entryType));
entryButton.setOnAction(event -> setEntryTypeForReturnAndClose(Optional.of(entryType)));
pane.getChildren().add(entryButton);
}
}
Expand Down Expand Up @@ -162,8 +163,8 @@ private void focusTextField(Event event) {
idTextField.selectAll();
}

private void setEntryTypeForReturnAndClose(BibEntryType entryType) {
type = entryType.getType();
private void setEntryTypeForReturnAndClose(Optional<BibEntryType> entryType) {
type = entryType.map(BibEntryType::getType).orElse(null);
viewModel.stopFetching();
this.close();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/csl-styles
Submodule csl-styles updated 503 files

0 comments on commit 6b97d67

Please sign in to comment.