aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/TextProcessing
diff options
context:
space:
mode:
authorMarcel Klehr <mklehr@gmx.net>2023-11-09 15:38:59 +0100
committerMarcel Klehr <mklehr@gmx.net>2023-11-09 15:38:59 +0100
commit017f1360597deabd989b60727c514fb8880e3e24 (patch)
tree2ba83ab26c3cc113763353762604c2e61674c3be /lib/private/TextProcessing
parent5704281276274084fa9b9031633d0f460fbcb377 (diff)
downloadnextcloud-server-017f1360597deabd989b60727c514fb8880e3e24.tar.gz
nextcloud-server-017f1360597deabd989b60727c514fb8880e3e24.zip
fix: Don't try to access undefined array key
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Diffstat (limited to 'lib/private/TextProcessing')
-rw-r--r--lib/private/TextProcessing/Manager.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/private/TextProcessing/Manager.php b/lib/private/TextProcessing/Manager.php
index c165f229919..41a4a5dedad 100644
--- a/lib/private/TextProcessing/Manager.php
+++ b/lib/private/TextProcessing/Manager.php
@@ -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'));