Skip to content

Commit

Permalink
empty regex fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KentoNishi committed May 28, 2024
1 parent 6797867 commit fc62613
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/components/YtcFilterWelcome.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<br />
<strong>v{version}:</strong>
<span>
new auto-open setting + UI tweaks.
new auto-open setting, UI tweaks, minor fixes.
</span>
</p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/settings/YtcFilterArchiveList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
</tr>
{#each data.slice(startIndex, startIndex + 10) as item, i (item.key)}
<tr class="hover-highlight" style="padding: 0x 5px;" on:click={isArchiveLoadSelection ? loadArchiveEntry(item) : undefined}>
<td>{item.info?.video.videoId}</td>
<td style="white-space: nowrap;">{item.info?.video.videoId}</td>
<td style="width: 100%;">
{computeName(item)}
</td>
Expand Down
18 changes: 12 additions & 6 deletions src/ts/ytcf-logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,14 @@ export function shouldFilterMessage(action: Chat.MessageAction): boolean {
break;
}
} else {
const regex = parseRegex(condition.value);
const result = regex.test(compStr);
if (!condition.value) {
numValidFilters--;
} else if (result === condition.invert) {
break;
} else {
const regex = parseRegex(condition.value);
const result = regex.test(compStr);
if (result === condition.invert) {
break;
}
}
}
numSatisfied++;
Expand Down Expand Up @@ -105,8 +107,12 @@ export function shouldActivatePreset(preset: YtcF.FilterPreset, info: SimpleVide
if (result) return true;
} else {
const regex = parseRegex(trigger.value);
const result = regex.test(compStr);
if (result) return true;
try {
const result = regex.test(compStr);
if (result) return true;
} catch (e) {
console.error(e);
}
}
}
return false;
Expand Down

0 comments on commit fc62613

Please sign in to comment.