🐛 FIX: 修复没有配置导致初始化nil错误

This commit is contained in:
dexter
2022-09-19 00:14:22 +08:00
parent d4f76fd1c4
commit 3db62a9e18

View File

@@ -43,6 +43,12 @@ var plugin = InstallPlugin(&HookConfig{
func (h *HookConfig) OnEvent(event any) {
switch v := event.(type) {
case FirstConfig:
if h.RequestList == nil {
h.RequestList = make(map[string]*HookAddr)
}
if h.URLList == nil {
h.URLList = make(map[string]string)
}
if h.BaseURL != "" {
for k, u := range h.URLList {
if !strings.HasSuffix(u, "http") {