Fix potential NPE

@see https://www.filebot.net/forums/viewtopic.php?f=6&t=4234&p=23851#p23851
This commit is contained in:
Reinhard Pointner 2016-10-17 02:41:33 +08:00
parent 23542c58c5
commit 32a1d60e7b
1 changed files with 2 additions and 2 deletions

View File

@ -969,8 +969,8 @@ public class MediaDetection {
for (String term : terms) {
if (term != null && term.length() > 0) {
String key = keyFunction.apply(term);
if (key != null && key.length() > 0 && !uniqueMap.containsKey(key)) {
uniqueMap.put(key, valueFunction.apply(term));
if (key != null && key.length() > 0) {
uniqueMap.computeIfAbsent(key, k -> valueFunction.apply(term));
}
}
}