fix: handle bad access when accessing paths (#2375)
This commit is contained in:
@@ -160,14 +160,21 @@ export class FilesBackupService
|
||||
}
|
||||
|
||||
private async automaticallyEnableTextBackupsIfPreferenceNotSet(): Promise<void> {
|
||||
if (this.storage.getValue(StorageKey.TextBackupsEnabled) == undefined) {
|
||||
this.storage.setValue(StorageKey.TextBackupsEnabled, true)
|
||||
const location = await this.device.joinPaths(
|
||||
await this.device.getUserDocumentsDirectory(),
|
||||
await this.prependWorkspacePathForPath(TextBackupsDirectoryName),
|
||||
)
|
||||
this.storage.setValue(StorageKey.TextBackupsLocation, location)
|
||||
if (this.storage.getValue(StorageKey.TextBackupsEnabled) != undefined) {
|
||||
return
|
||||
}
|
||||
|
||||
this.storage.setValue(StorageKey.TextBackupsEnabled, true)
|
||||
const documentsDir = await this.device.getUserDocumentsDirectory()
|
||||
if (!documentsDir) {
|
||||
return
|
||||
}
|
||||
|
||||
const location = await this.device.joinPaths(
|
||||
documentsDir,
|
||||
await this.prependWorkspacePathForPath(TextBackupsDirectoryName),
|
||||
)
|
||||
this.storage.setValue(StorageKey.TextBackupsLocation, location)
|
||||
}
|
||||
|
||||
openAllDirectoriesContainingBackupFiles(): void {
|
||||
|
||||
@@ -170,6 +170,9 @@ export class HomeServerService
|
||||
let location = await this.getHomeServerDataLocation()
|
||||
if (!location) {
|
||||
const documentsDirectory = await this.desktopDevice.getUserDocumentsDirectory()
|
||||
if (!documentsDirectory) {
|
||||
return
|
||||
}
|
||||
location = `${documentsDirectory}/${this.HOME_SERVER_DATA_DIRECTORY_NAME}`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user