summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/files_versions/lib/Storage.php5
-rw-r--r--apps/files_versions/tests/VersioningTest.php5
2 files changed, 10 insertions, 0 deletions
diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php
index cb5a02581b5..2b896a0cf67 100644
--- a/apps/files_versions/lib/Storage.php
+++ b/apps/files_versions/lib/Storage.php
@@ -641,6 +641,11 @@ class Storage {
}
$firstVersion = reset($versions);
+
+ if ($firstVersion === false) {
+ return [$toDelete, $size];
+ }
+
$firstKey = key($versions);
$prevTimestamp = $firstVersion['version'];
$nextVersion = $firstVersion['version'] - $step;
diff --git a/apps/files_versions/tests/VersioningTest.php b/apps/files_versions/tests/VersioningTest.php
index 26429574364..b6d317ea25e 100644
--- a/apps/files_versions/tests/VersioningTest.php
+++ b/apps/files_versions/tests/VersioningTest.php
@@ -274,6 +274,11 @@ class VersioningTest extends \Test\TestCase {
],
9 // size of all deleted files (every file has the size 1)
],
+ // fourth set of versions: empty (see issue #19066)
+ [
+ [],
+ 0
+ ]
];
}