[Glitch] Fix WebUI crash when language detection code returns `undefined`
Port 8dcfd3f246
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
bfb9092890
commit
38905ae658
|
@ -78,6 +78,9 @@ const detectedLanguage = createSelector([
|
||||||
], text => {
|
], text => {
|
||||||
if (text.length > 20) {
|
if (text.length > 20) {
|
||||||
const guesses = debouncedLande(text);
|
const guesses = debouncedLande(text);
|
||||||
|
if (!guesses)
|
||||||
|
return '';
|
||||||
|
|
||||||
const [lang, confidence] = guesses[0];
|
const [lang, confidence] = guesses[0];
|
||||||
|
|
||||||
if (confidence > 0.8) {
|
if (confidence > 0.8) {
|
||||||
|
|
Loading…
Reference in New Issue