Fix bug with undefined char on empty chats

This commit is contained in:
Wolfsblvt 2024-09-29 13:38:15 +02:00
parent 57bbd349a0
commit 8e445c75ae
1 changed files with 1 additions and 1 deletions

View File

@ -2139,7 +2139,7 @@ export function findChar({ name = null, allowAvatar = true, insensitive = true,
// Get the current character(s) // Get the current character(s)
/** @type {any[]} */ /** @type {any[]} */
const currentChars = selected_group ? groups.find(group => group.id === selected_group)?.members.map(member => filteredCharacters.find(char => char.avatar === member)) const currentChars = selected_group ? groups.find(group => group.id === selected_group)?.members.map(member => filteredCharacters.find(char => char.avatar === member))
: [filteredCharacters.find(char => characters[this_chid]?.avatar === char.avatar)]; : filteredCharacters.filter(char => characters[this_chid]?.avatar === char.avatar);
// If we have a current char and prefer it, return that if it matches // If we have a current char and prefer it, return that if it matches
if (preferCurrentChar) { if (preferCurrentChar) {