Skip to content

Build your personal knowledge base with Trilium Notes

fix(electron): not starting on an empty DB

--global0cedd697cc2b
diff --git a/src/services/options.ts b/src/services/options.ts
index a5516df1a8..3d54fde5fd 100644
--- a/src/services/options.ts
+++ b/src/services/options.ts
@@ -25,7 +25,12 @@ function getOptionOrNull(name: OptionNames): string | null {
option = becca.getOption(name);
} else {
// e.g. in initial sync becca is not loaded because DB is not initialized
- option = sql.getRow<OptionRow>("SELECT * FROM options WHERE name = ?", [name]);
+ try {
+ option = sql.getRow<OptionRow>("SELECT * FROM options WHERE name = ?", [name]);
+ } catch (e: unknown) {
+ // DB is not initialized.
+ return null;
+ }
}
return option ? option.value : null;