Merge pull request #5411 from ByteHamster/fix-null-pubdate

Fix NPE in duplicate detection
This commit is contained in:
ByteHamster 2021-09-17 22:29:42 +02:00 committed by GitHub
commit f378d2cf34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -359,8 +359,11 @@ public final class DBTasks {
&& TextUtils.equals(item.getMedia().getStreamUrl(), searchItem.getMedia().getStreamUrl())) {
return item;
} else if (titlesLookSimilar(item.getTitle(), searchItem.getTitle())) {
if (searchItem.getPubDate() == null || item.getPubDate() == null) {
continue;
}
long dateOriginal = item.getPubDate().getTime();
long dateNew = searchItem.getPubDate() == null ? 0 : searchItem.getPubDate().getTime();
long dateNew = searchItem.getPubDate().getTime();
if (Math.abs(dateOriginal - dateNew) < 7L * 24L * 3600L * 1000L) { // Same week
return item;
}