mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-12 17:09:37 +08:00
fix(translate): 处理未选择文件时提前返回以避免空指针异常
This commit is contained in:
parent
6c9202c5d5
commit
f74c63ff77
@ -439,6 +439,9 @@ const TranslatePage: FC = () => {
|
|||||||
setIsProcessing(true)
|
setIsProcessing(true)
|
||||||
try {
|
try {
|
||||||
const [file] = await onSelectFile({ multipleSelections: false })
|
const [file] = await onSelectFile({ multipleSelections: false })
|
||||||
|
if (!file) {
|
||||||
|
return
|
||||||
|
}
|
||||||
if (isSupportedOcrFile(file)) {
|
if (isSupportedOcrFile(file)) {
|
||||||
window.message.loading({ content: t('ocr.processing'), key: 'translate_ocr_processing', duration: 0 })
|
window.message.loading({ content: t('ocr.processing'), key: 'translate_ocr_processing', duration: 0 })
|
||||||
const ocrResult = await ocr(file)
|
const ocrResult = await ocr(file)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user