fix: handle bad access when accessing paths (#2375)

This commit is contained in:
Mo
2023-07-27 13:09:03 -05:00
committed by GitHub
parent bfd2b14264
commit 804a39dabc
10 changed files with 63 additions and 44 deletions

View File

@@ -88,7 +88,7 @@ export class FilesBackupManager implements FileBackupsDevice {
return value === true
}
async getUserDocumentsDirectory(): Promise<string> {
async getUserDocumentsDirectory(): Promise<string | undefined> {
return Paths.documentsDir
}
@@ -103,7 +103,12 @@ export class FilesBackupManager implements FileBackupsDevice {
}
const LegacyTextBackupsDirectory = 'Standard Notes Backups'
return path.join(Paths.homeDir, LegacyTextBackupsDirectory)
const homeDir = Paths.homeDir
if (homeDir) {
return path.join(homeDir, LegacyTextBackupsDirectory)
}
return undefined
}
private getFileBackupsMappingFilePath(backupsLocation: string): string {