Ignore empty tasks

This commit is contained in:
Gres 2020-03-09 11:47:40 +03:00
parent d945081dab
commit a4df962ca8
2 changed files with 11 additions and 0 deletions

View File

@ -13,6 +13,11 @@ void Corrector::correct(const TaskPtr &task)
SOFT_ASSERT(task, return );
SOFT_ASSERT(task->isValid(), return );
if (task->recognized.isEmpty()) {
manager_.corrected(task);
return;
}
if (!userSubstitutions_.empty())
task->corrected = substituteUser(task->recognized, task->sourceLanguage);

View File

@ -96,6 +96,12 @@ Translator::~Translator() = default;
void Translator::translate(const TaskPtr &task)
{
SOFT_ASSERT(task, return );
if (task->corrected.isEmpty()) {
manager_.translated(task);
return;
}
queue_.push_back(task);
processQueue();
}