Skip to content

Commit

Permalink
BUGFIX: Skip null when updating workspace info
Browse files Browse the repository at this point in the history
A variant of the (potential) error fixed in the previous commit.
  • Loading branch information
kdambekalns authored Oct 21, 2024
1 parent 965d08c commit 139cfee
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Classes/Controller/BackendServiceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,18 @@ protected function updateWorkspaceInfo(string $documentNodeContextPath): void
{
$updateWorkspaceInfo = new UpdateWorkspaceInfo();
$documentNode = $this->nodeService->getNodeFromContextPath($documentNodeContextPath, null, null, true);
$updateWorkspaceInfo->setWorkspace(
$documentNode->getContext()->getWorkspace()
);
if ($documentNode === null) {
$error = new Error();
$error->setMessage(sprintf('Could not find node for document node context path "%s"', $documentNodeContextPath));

$this->feedbackCollection->add($error);
} else {
$updateWorkspaceInfo->setWorkspace(
$documentNode->getContext()->getWorkspace()
);

$this->feedbackCollection->add($updateWorkspaceInfo);
$this->feedbackCollection->add($updateWorkspaceInfo);
}
}

/**
Expand Down

0 comments on commit 139cfee

Please sign in to comment.