From b26f78a57687d09caea38279e51dfddeafb65a95 Mon Sep 17 00:00:00 2001 From: death-claw <53543762+death-claw@users.noreply.github.com> Date: Sun, 21 Apr 2024 10:24:55 +0100 Subject: [PATCH] fixes #187 (#188) --- .../main/kotlin/me/vripper/tasks/AddPostRunnable.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/vripper-core/src/main/kotlin/me/vripper/tasks/AddPostRunnable.kt b/vripper-core/src/main/kotlin/me/vripper/tasks/AddPostRunnable.kt index 263e9322..66722aa0 100644 --- a/vripper-core/src/main/kotlin/me/vripper/tasks/AddPostRunnable.kt +++ b/vripper-core/src/main/kotlin/me/vripper/tasks/AddPostRunnable.kt @@ -76,7 +76,17 @@ class AddPostRunnable(private val items: List) : KoinComponent, Ru } } - val postItem = threadItem.postItemList.first() + val postItem = threadItem.postItemList.firstOrNull { it.postId == postId } + if (postItem == null) { + dataTransaction.saveLog( + LogEntryEntity( + type = LogEntryEntity.Type.POST, + status = LogEntryEntity.Status.ERROR, + message = "Unable to load $link" + ) + ) + continue + } toProcess.add(postItem) }