Skip to content

Commit

Permalink
fix(dav): Handle no next potential toggle in availability detection
Browse files Browse the repository at this point in the history
Fixes:  min(): Array must contain at least one element at /var/www/nc/nextcloud/apps/dav/lib/BackgroundJob/UserStatusAutomation.php#142
Signed-off-by: Thomas Citharel <[email protected]>
  • Loading branch information
tcitworld committed Mar 10, 2023
1 parent 16b68fd commit b509e6b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions apps/dav/lib/BackgroundJob/UserStatusAutomation.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ protected function run($argument) {
}
}

if (count($nextPotentialToggles) === 0) {
$this->logger->info('Removing ' . self::class . ' background job for user "' . $userId . '" because the user has no valid availability rules set');
$this->jobList->remove(self::class, $argument);
return;
}

$nextAutomaticToggle = min($nextPotentialToggles);
$this->setLastRunToNextToggleTime($userId, $nextAutomaticToggle - 1);

Expand Down

0 comments on commit b509e6b

Please sign in to comment.