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) }