Skip to content

Commit 07a4012

Browse files
Merge pull request #2105 from Dominik0101/fix-backup-cache-null
Fix backup cache handling when JSON decode returns null
2 parents 7f91ea0 + 1b1154a commit 07a4012

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

ncp-web/backups.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ function filesize_compat($file)
5555
$cache_str = file_get_contents($cache_file)
5656
or exit("error opening ${cache_file}");
5757

58-
$cache = json_decode($cache_str, true) or [];
58+
$cache = json_decode($cache_str, true);
59+
if (!is_array($cache)) {
60+
$cache = [];
61+
}
5962
} else {
6063
$cache = [];
6164
}

0 commit comments

Comments
 (0)