Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: Fix npe

Daniel2e34258b1337
diff --git a/app/src/layout/topBar.ts b/app/src/layout/topBar.ts
index 2d997d0832..3e8f6db4dd 100644
--- a/app/src/layout/topBar.ts
+++ b/app/src/layout/topBar.ts
@@ -122,6 +122,10 @@ export const initBar = (app: App) => {
window.siyuan.menus.menu.remove();
window.siyuan.menus.menu.element.setAttribute("data-name", Constants.MENU_BAR_MORE);
(target.getAttribute("data-hideids") || "").split(",").forEach((itemId) => {
+ // data-hideids 可能为空字符串,split(",") 会得到 [""],导致 querySelector("#") 抛出无效选择器异常
+ if (!itemId) {
+ return;
+ }
const hideElement = toolbarElement.querySelector("#" + itemId);
const useElement = hideElement.querySelector("use");
const menuOptions: IMenu = {