Skip to content

Commit

Permalink
Add a sanity check to the logic gathering the folder tree
Browse files Browse the repository at this point in the history
In case the oc_filecache table would contain some invalid parent references
(i.e. the file index is somehow corrupted), ignore those when building the
folder tree. Previously, such references caused null values to be included in
the result of the REST API method `api/folders`, which prevented the web UI
from showing any folders.

refs #955
  • Loading branch information
paulijar committed Apr 17, 2022
1 parent d9c48f2 commit c604be3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/BusinessLayer/TrackBusinessLayer.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,10 @@ private function recursivelyAddMissingParentFolders(array $foldersToProcess, arr
$newParents = [];
foreach ($parentIds as $parentId) {
if ($parentId !== null) {
$newParents[] = self::getFolderEntry($parentInfo, $parentId, [], $musicFolder);
$parentEntry = self::getFolderEntry($parentInfo, $parentId, [], $musicFolder);
if ($parentEntry !== null) {
$newParents[] = $parentEntry;
}
}
}

Expand Down

0 comments on commit c604be3

Please sign in to comment.