Skip to content

Commit

Permalink
fix: check if file exists before deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
devcatalin committed Nov 18, 2021
1 parent 9cadf54 commit 13b882d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/redux/services/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,11 @@ export function removeResourceFromFile(
}
const absoluteFilePath = getAbsoluteResourcePath(removedResource, fileMap);

if (!fs.existsSync(absoluteFilePath)) {
log.error(`[removeResourceFromFile] - ${absoluteFilePath} doesn't exist`);
return;
}

// get list of resourceIds in file sorted by startPosition
const resourceIds = getResourcesForPath(removedResource.filePath, resourceMap)
.sort((a, b) => {
Expand Down

0 comments on commit 13b882d

Please sign in to comment.