From 0b69aec68b578487f7ee5c8e38448f1549efe165 Mon Sep 17 00:00:00 2001 From: Research Assistant Date: Thu, 14 May 2026 23:48:54 +0800 Subject: [PATCH] fix: guard features object in settings to prevent crash on first render --- paperforge/plugin/main.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/paperforge/plugin/main.js b/paperforge/plugin/main.js index c36fc4cb..33a4196d 100644 --- a/paperforge/plugin/main.js +++ b/paperforge/plugin/main.js @@ -2936,6 +2936,11 @@ class PaperForgeSettingTab extends PluginSettingTab { // --- Vector Database (within Memory Layer) --- containerEl.createEl('h4', { text: 'Vector Database' }); + // Ensure features object exists for upgrades from older settings + if (!this.plugin.settings.features) { + this.plugin.settings.features = { memory_layer: true, vector_db: false }; + } + const vecDescEl = containerEl.createEl('div', { cls: 'paperforge-desc-box' }); vecDescEl.style.cssText = 'padding:8px 12px; margin:0 0 8px; background:var(--background-secondary); border-radius:4px; font-size:12px; color:var(--text-muted); line-height:1.5;'; vecDescEl.setText(t('feat_vector_desc'));