protect from null mentions

This commit is contained in:
keyan 2021-08-19 14:53:11 -05:00
parent c239d05e30
commit 099a578a1b
1 changed files with 2 additions and 2 deletions

View File

@ -294,8 +294,8 @@ const createMentions = async (item, models) => {
}
try {
const mentions = item.text.match(namePattern).map(m => m.slice(1))
if (mentions.length > 0) {
const mentions = item.text.match(namePattern)?.map(m => m.slice(1))
if (mentions?.length > 0) {
const users = await models.user.findMany({
where: {
name: { in: mentions }