fix: undefined in title

This commit is contained in:
Yang Jun 2025-05-04 12:40:25 +08:00
parent 8665a08360
commit dcdfa59db4

View file

@ -38,7 +38,7 @@ export function addModel(
(prev, curr) => (curr.title.startsWith(model.title) ? prev + 1 : prev),
0,
);
if (numMatches !== 0) {
if (numMatches !== undefined && numMatches > 0) {
model.title = `${model.title} (${numMatches})`;
}
@ -63,7 +63,7 @@ export function addModel(
"name" in curr && curr.name.startsWith(model.title) ? prev + 1 : prev,
0,
);
if (numMatches !== 0) {
if (numMatches !== undefined && numMatches > 0) {
model.title = `${model.title} (${numMatches})`;
}