fix: langIcon throws on an explicit null opts argument (#1740)

This commit is contained in:
Afonso Coutinho
2026-06-03 05:29:21 +01:00
committed by GitHub
parent fc8efca49d
commit 7f94c43a45
2 changed files with 42 additions and 2 deletions
+2 -2
View File
@@ -175,8 +175,8 @@ export function langIcon(lang, size = 14, opts = {}) {
const key = String(lang).toLowerCase();
const inner = ICONS[key] || ICONS[ALIASES[key]] || '';
if (!inner) return '';
const cls = opts.className ? ` class="${opts.className}"` : '';
const style = opts.style ? ` style="${opts.style}"` : '';
const cls = (opts && opts.className) ? ` class="${opts.className}"` : '';
const style = (opts && opts.style) ? ` style="${opts.style}"` : '';
return (
`<svg${cls}${style} width="${size}" height="${size}" viewBox="0 0 24 24" ` +
`fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">` +