From 99963defe27cb1d80f2922412494b1c34164b75c Mon Sep 17 00:00:00 2001 From: Markus Date: Mon, 12 Oct 2020 11:06:55 +0200 Subject: [PATCH] Fix DatasetMatcher NPE --- .../main/java/life/catalogue/matching/DatasetMatcher.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dao/src/main/java/life/catalogue/matching/DatasetMatcher.java b/dao/src/main/java/life/catalogue/matching/DatasetMatcher.java index 0b06739fce..84c49ce7fd 100644 --- a/dao/src/main/java/life/catalogue/matching/DatasetMatcher.java +++ b/dao/src/main/java/life/catalogue/matching/DatasetMatcher.java @@ -93,9 +93,10 @@ public void accept(Name n) { total++; Integer oldId = n.getNameIndexId(); NameMatch m = ni.match(n, allowInserts, false); - - if (!Objects.equals(oldId, m.getName().getKey())) { - nm.updateMatch(datasetKey, n.getId(), m.getName().getKey(), m.getType()); + + Integer newKey = m.hasMatch() ? m.getName().getKey() : null; + if (!Objects.equals(oldId, newKey)) { + nm.updateMatch(datasetKey, n.getId(), newKey, m.getType()); if (updateIssues) { IssueContainer v = n.getVerbatimKey() != null ? vmGet.getIssues(key.id(n.getVerbatimKey())) : null; if (v != null) {