Skip to content

Node.js based forum software built for the modern web

fix: crash in tests

Barış Soner Uşaklı6c2100684b7a
diff --git a/src/posts/create.js b/src/posts/create.js
index 5d56c05d26..e74299c27c 100644
--- a/src/posts/create.js
+++ b/src/posts/create.js
@@ -71,7 +71,7 @@ module.exports = function (Posts) {
const topicData = await topics.getTopicFields(tid, ['cid', 'pinned']);
postData.cid = topicData.cid;
- const hasAttachment = _activitypub.attachment && _activitypub.attachment.length;
+ const hasAttachment = _activitypub && _activitypub.attachment && _activitypub.attachment.length;
await Promise.all([
db.sortedSetAdd('posts:pid', timestamp, postData.pid),