提交 ca6eaaa1 编写于 作者: T Tyler James Leonhardt

fix languageDetection throwing an error due to not handling empty array case

上级 baed4398
......@@ -123,11 +123,9 @@ export class LanguageDetectionService extends Disposable implements ILanguageDet
}
const modelResults = await modelOperations.runModel(content);
if (!modelResults) {
return;
}
if (modelResults[0].confidence < LanguageDetectionService.expectedRelativeConfidence) {
if (!modelResults
|| modelResults.length === 0
|| modelResults[0].confidence < LanguageDetectionService.expectedRelativeConfidence) {
return;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册