]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix: Don't try to access undefined array key
authorMarcel Klehr <mklehr@gmx.net>
Thu, 9 Nov 2023 14:38:59 +0000 (15:38 +0100)
committerMarcel Klehr <mklehr@gmx.net>
Thu, 9 Nov 2023 14:38:59 +0000 (15:38 +0100)
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
lib/private/TextProcessing/Manager.php

index c165f2299193624bcfffa670bc829c8477b84bd3..41a4a5dedadd751098485ad71a5ba47a181d7e90 100644 (file)
@@ -158,7 +158,11 @@ class Manager implements IManager {
                        throw new PreConditionNotMetException('No LanguageModel provider is installed that can handle this task');
                }
                $task->setStatus(OCPTask::STATUS_SCHEDULED);
-               [$provider,] = $this->getPreferredProviders($task);
+               $providers = $this->getPreferredProviders($task);
+               if (count($providers) === 0) {
+                       throw new PreConditionNotMetException('No LanguageModel provider is installed that can handle this task');
+               }
+               [$provider,] = $providers;
                if ($provider instanceof IProviderWithExpectedRuntime) {
                        $completionExpectedAt = new \DateTime('now');
                        $completionExpectedAt->add(new \DateInterval('PT'.$provider->getExpectedRuntime().'S'));