Fix non-provided name not correctly preferring cur

7c2fcbc522dc9f80093dde70b1967acad8c113b8

Wolfsblvt <wolfsblvt@gmail.com>

1 files changed, +5 -5Showing whitespace changes
public/scripts/utils.js+5 -5
@@ -2125,7 +2125,7 @@ export async function showFontAwesomePicker(customList = null) {
21252125 * @returns {any?} - The found character or null if not found
21262126 */
21272127export function findChar({ name = null, allowAvatar = true, insensitive = true, filteredByTags = null, preferCurrentChar = true, quiet = false } = {}) {
21282128 const matches = (char) => !name || (allowAvatar && char.avatar === name) || (insensitive ? equalsIgnoreCaseAndAccents(char.name, name) : char.name === name);
21292129
21302130 // Filter characters by tags if provided
21312131 let filteredCharacters = characters;
@@ -2145,8 +2145,8 @@ export function findChar({ name = null, allowAvatar = true, insensitive = true,
21452145 if (preferCurrentChar) {
21462146 const preferredCharSearch = currentChars.filter(matches);
21472147 if (preferredCharSearch.length > 1) {
21482148 if (!quiet) toastr.warning(`'Multiple characters found for name "${name}" and given conditions.`');
21492149 else console.warn(`'Multiple characters found for namegiven "${name}"conditions. Returning the first match.`');
21502150 }
21512151 if (preferredCharSearch.length) {
21522152 return preferredCharSearch[0];
@@ -2164,8 +2164,8 @@ export function findChar({ name = null, allowAvatar = true, insensitive = true,
21642164 // Search for matching characters by name
21652165 const matchingCharacters = name ? filteredCharacters.filter(matches) : filteredCharacters;
21662166 if (matchingCharacters.length > 1) {
21672167 if (!quiet) toastr.warning(`'Multiple characters found for name "${name}" and given conditions.`');
21682168 else console.warn(`'Multiple characters found for namegiven "${name}"conditions. Returning the first match.`');
21692169 }
21702170
21712171 return matchingCharacters[0] || null;