Skip to content

Commit

Permalink
Handle empty settings object (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
Acylation authored Jan 30, 2024
1 parent 2799e88 commit b463490
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export default class ChemPlugin extends Plugin {
const candidate = Object.assign({}, await this.loadData());
if ('version' in candidate && candidate.version == SETTINGS_VERSION)
this.settings = Object.assign({}, DEFAULT_SETTINGS, candidate);
else if (Object.keys(candidate).length === 0)
this.settings = Object.assign({}, DEFAULT_SETTINGS);
else
this.settings = Object.assign(
{},
Expand Down

0 comments on commit b463490

Please sign in to comment.