Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fix crash on dirTree and open empty folder

sytolk519823d1cd20
diff --git a/src/renderer/components/DirectoryTreeView.tsx b/src/renderer/components/DirectoryTreeView.tsx
index 3f9113e14..ba4ac8934 100644
--- a/src/renderer/components/DirectoryTreeView.tsx
+++ b/src/renderer/components/DirectoryTreeView.tsx
@@ -161,23 +161,25 @@ const DirectoryTreeView = forwardRef(
const renderBodyRow = (propsRow: any) => {
const subFolderLocation = propsRow.location;
- const loc = findLocation(subFolderLocation.locationID);
- if (AppConfig.isElectron || loc.type !== locationType.TYPE_CLOUD) {
- // DnD to S3 location is not permitted in web browser without <input> element
- return (
- <TargetFileBox
- accepts={[FILE]}
- directoryPath={subFolderLocation.path}
- locationId={subFolderLocation.locationID}
- >
- <CustomDragLayer />
- <TargetTableMoveFileBox
- accepts={[DragItemTypes.FILE]}
- onDrop={handleFileMoveDrop}
- {...propsRow}
- />
- </TargetFileBox>
- );
+ if (subFolderLocation) {
+ const loc = findLocation(subFolderLocation.locationID);
+ if (AppConfig.isElectron || loc.type !== locationType.TYPE_CLOUD) {
+ // DnD to S3 location is not permitted in web browser without <input> element
+ return (
+ <TargetFileBox
+ accepts={[FILE]}
+ directoryPath={subFolderLocation.path}
+ locationId={subFolderLocation.locationID}
+ >
+ <CustomDragLayer />
+ <TargetTableMoveFileBox
+ accepts={[DragItemTypes.FILE]}
+ onDrop={handleFileMoveDrop}
+ {...propsRow}
+ />
+ </TargetFileBox>
+ );
+ }
}
return <tr {...propsRow} />;
};