Skip to content

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

minor change

sytolk4f24977d21d5
diff --git a/src/renderer/hooks/LocationIndexContextProvider.tsx b/src/renderer/hooks/LocationIndexContextProvider.tsx
index f1d848341..8be45a3a0 100644
--- a/src/renderer/hooks/LocationIndexContextProvider.tsx
+++ b/src/renderer/hooks/LocationIndexContextProvider.tsx
@@ -751,27 +751,26 @@ export const LocationIndexContextProvider = ({
return loc
.getPropertiesPromise(folderIndexPath)
.then((indexFile: TS.FileSystemEntry) => {
- const indexAge = new Date().getTime() - indexFile.lmdt;
- if (
- loc.disableIndexing ||
- (indexFile && indexAge < maxIndexAge.current)
- ) {
- return loc
- .loadTextFilePromise(folderIndexPath)
- .then((jsonContent) => {
- const directoryIndex = loadJSONString(
- jsonContent,
- ) as TS.FileSystemEntry[];
- return enhanceDirectoryIndex(
- directoryIndex,
- locationID,
- folderPath,
- );
- })
- .catch((e) => {
- console.log('cannot load json:' + folderPath, e);
- return undefined;
- });
+ if (indexFile) {
+ const indexAge = new Date().getTime() - indexFile.lmdt;
+ if (loc.disableIndexing || indexAge < maxIndexAge.current) {
+ return loc
+ .loadTextFilePromise(folderIndexPath)
+ .then((jsonContent) => {
+ const directoryIndex = loadJSONString(
+ jsonContent,
+ ) as TS.FileSystemEntry[];
+ return enhanceDirectoryIndex(
+ directoryIndex,
+ locationID,
+ folderPath,
+ );
+ })
+ .catch((e) => {
+ console.log('cannot load json:' + folderPath, e);
+ return undefined;
+ });
+ }
}
return undefined;
});