Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Takashi Tamura
2026-02-23 06:56:55 +09:00
committed by GitHub
parent 3017b9d709
commit dc9e5e1625

View File

@@ -106,7 +106,12 @@ function getLocationFragmentFromLinkText(linkText: string): string | undefined {
return undefined;
}
const fragment = decodeURIComponent(linkText.slice(fragmentStart + 1));
let fragment: string;
try {
fragment = decodeURIComponent(linkText.slice(fragmentStart + 1));
} catch {
return undefined;
}
if (!fragment) {
return undefined;
}