Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NPE in Duplicate Resolver Dialog #4791

Merged
merged 2 commits into from
Mar 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/DuplicateResolverDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public enum DuplicateResolverResult {

public DuplicateResolverDialog(BibEntry one, BibEntry two, DuplicateResolverType type, BibDatabaseContext database) {
this.setTitle(Localization.lang("Possible duplicate entries"));
init(one, two, type);
this.database = database;
init(one, two, type);
}

private void init(BibEntry one, BibEntry two, DuplicateResolverType type) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/PreviewPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public class PreviewPanel extends ScrollPane implements SearchQueryHighlightList

/**
* @param panel (may be null) Only set this if the preview is associated to the main window.
* @param databaseContext Used for resolving pdf directories for links. Must not be null.
* @param databaseContext Used for resolving pdf directories for links. Must not be null, just pass a new empty BibDatabaseContext()
*/
public PreviewPanel(BasePanel panel, BibDatabaseContext databaseContext, KeyBindingRepository keyBindingRepository, PreviewPreferences preferences, DialogService dialogService, ExternalFileTypes externalFileTypes) {
this.databaseContext = Objects.requireNonNull(databaseContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void makeChange(BibDatabaseContext database, NamedCompound undoEdit) {

@Override
public Node description() {
PreviewPanel previewPanel = new PreviewPanel(null, null, Globals.getKeyPrefs(), Globals.prefs.getPreviewPreferences(), new FXDialogService(), ExternalFileTypes.getInstance());
PreviewPanel previewPanel = new PreviewPanel(null, new BibDatabaseContext(), Globals.getKeyPrefs(), Globals.prefs.getPreviewPreferences(), new FXDialogService(), ExternalFileTypes.getInstance());
previewPanel.setEntry(diskEntry);
return previewPanel;
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/jabref/gui/search/SearchResultFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import org.jabref.logic.bibtex.comparator.FieldComparator;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.search.SearchQuery;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.FieldName;
import org.jabref.model.entry.FieldProperty;
Expand Down Expand Up @@ -122,7 +123,7 @@ private void init(String title) {
searchResultFrame.setTitle(title);
searchResultFrame.setIconImages(IconTheme.getLogoSet());

preview = new PreviewPanel(null, null, Globals.getKeyPrefs(), Globals.prefs.getPreviewPreferences(), frame.getDialogService(), ExternalFileTypes.getInstance());
preview = new PreviewPanel(null, new BibDatabaseContext(), Globals.getKeyPrefs(), Globals.prefs.getPreviewPreferences(), frame.getDialogService(), ExternalFileTypes.getInstance());

sortedEntries = new SortedList<>(entries, new EntryComparator(false, true, FieldName.AUTHOR));
model = (DefaultEventTableModel<BibEntry>) GlazedListsSwing.eventTableModelWithThreadProxyList(sortedEntries,
Expand Down