Fix bug if setting is missing

This commit is contained in:
Lost Paul 2023-08-12 23:38:02 +02:00
parent d57d5e983d
commit baebfe9630
2 changed files with 5 additions and 3 deletions

View file

@ -1,7 +1,7 @@
{
"id": "folder-notes",
"name": "Folder notes",
"version": "1.5.6",
"version": "1.5.7",
"minAppVersion": "0.15.0",
"description": "Create notes within folders that can be accessed without collapsing the folder, similar to the functionality offered in Notion.",
"author": "Lost Paul",

View file

@ -365,8 +365,10 @@ export default class FolderNotesPlugin extends Plugin {
}
async loadSettings() {
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
const overview = await (this.loadData() as any).defaultOverview;
const data = await this.loadData();
this.settings = Object.assign({}, DEFAULT_SETTINGS, data);
if (!data) { return; }
const overview = (data as any).defaultOverview;
if (!overview) { return; }
this.settings.defaultOverview = Object.assign({}, DEFAULT_SETTINGS.defaultOverview, overview);
}