From 4f5f1b8f2b4a310585edc8e46a480ec0b4c6c1b3 Mon Sep 17 00:00:00 2001 From: LTbinglingfeng Date: Sat, 13 Jun 2026 05:05:49 +0800 Subject: [PATCH] fix(plugins): guard config read with mutex --- internal/api/handlers/management/plugins.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/api/handlers/management/plugins.go b/internal/api/handlers/management/plugins.go index 0665a01b..3c7ed100 100644 --- a/internal/api/handlers/management/plugins.go +++ b/internal/api/handlers/management/plugins.go @@ -155,12 +155,17 @@ func (h *Handler) GetPluginConfig(c *gin.Context) { if !okID { return } - if h == nil || h.cfg == nil { + if h == nil { c.JSON(http.StatusNotFound, gin.H{"error": "plugin_not_found", "message": "plugin not found"}) return } h.mu.Lock() + if h.cfg == nil { + h.mu.Unlock() + c.JSON(http.StatusNotFound, gin.H{"error": "plugin_not_found", "message": "plugin not found"}) + return + } item, configured := h.cfg.Plugins.Configs[id] pluginsDir := normalizedPluginsDir(h.cfg.Plugins.Dir) host := h.pluginHost