Skip to content

Commit b463490

Browse files
authored
Handle empty settings object (#54)
1 parent 2799e88 commit b463490

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/main.ts

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ export default class ChemPlugin extends Plugin {
4242
const candidate = Object.assign({}, await this.loadData());
4343
if ('version' in candidate && candidate.version == SETTINGS_VERSION)
4444
this.settings = Object.assign({}, DEFAULT_SETTINGS, candidate);
45+
else if (Object.keys(candidate).length === 0)
46+
this.settings = Object.assign({}, DEFAULT_SETTINGS);
4547
else
4648
this.settings = Object.assign(
4749
{},

0 commit comments

Comments
 (0)