fix: guard against undefined entry in domainLink helper
Some checks failed
continuous-integration/drone/push Build is failing

Add null checks to prevent runtime errors when the domain index entry
does not exist for the given identifier.
This commit is contained in:
nemunaire 2026-04-05 10:58:14 +07:00
commit 8e2e38757f

View file

@ -110,5 +110,10 @@ export const domains_by_groups = derived(domains, ($domains: Array<Domain> | und
});
export function domainLink(dnid: string): string {
return get(domains_idx)[get(domains_idx)[dnid].domain] ? get(domains_idx)[dnid].domain : dnid;
const idx = get(domains_idx);
const entry = idx[dnid];
if (entry && idx[entry.domain]) {
return entry.domain;
}
return dnid;
}