Skip to content

Commit 155007c

Browse files
committed
fix: add null check for envelope folder node
Psalm static analysis reported that getFirstNodeById() can return null, but getFolderForFile() was not handling this case. Added explicit null check along with instance check to ensure type safety and prevent potential null pointer errors. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent e1288e5 commit 155007c

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

lib/Service/FolderService.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ public function getFolderForFile(array $data, $identifier): Folder {
137137

138138
if (isset($data['settings']['envelopeFolderId'])) {
139139
$envelopeFolder = $userFolder->getFirstNodeById($data['settings']['envelopeFolderId']);
140+
if ($envelopeFolder === null || !$envelopeFolder instanceof Folder) {
141+
throw new LibresignException($this->l10n->t('Envelope folder not found'));
142+
}
140143
return $envelopeFolder;
141144
}
142145

0 commit comments

Comments
 (0)