Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f3992fb

Browse files
committed
api/language-codes: prevent errors if code is undefined
1 parent 810e0a8 commit f3992fb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎api/src/misc/language-codes.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ const maps = {
4949
}
5050

5151
export const convertLanguageCode = (code) => {
52-
code = code.split("-")[0].split("_")[0];
52+
code = code?.split("-")[0]?.split("_")[0]||"";
5353
return maps[code.length]?.[code.toLowerCase()] || null;
5454
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /