Skip to content

Commit

Permalink
Issue backdrop#3484: Make sure file_load succeeds before adding usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
indigoxela committed Oct 13, 2020
1 parent 5aba056 commit 080716b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions core/modules/filter/filter.module
Expand Up @@ -1756,11 +1756,13 @@ function filter_node_revision_delete(Node $node) {
function _filter_record_file_usage(array $fids, EntityInterface $entity) {
foreach ($fids as $fid) {
$file = file_load($fid);
if ($file && $file->status != FILE_STATUS_PERMANENT) {
$file->status = FILE_STATUS_PERMANENT;
$file->save();
if ($file) {
if ($file->status != FILE_STATUS_PERMANENT) {
$file->status = FILE_STATUS_PERMANENT;
$file->save();
}
file_usage_add($file, 'filter', $entity->entityType(), $entity->id());
}
file_usage_add($file, 'filter', $entity->entityType(), $entity->id());
}
}

Expand Down

0 comments on commit 080716b

Please sign in to comment.