Skip to content

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

:bug: Fix NPE https://github.com/siyuan-note/siyuan/issues/11508

Daniel269f0afc1cbf
diff --git a/kernel/util/rhy.go b/kernel/util/rhy.go
index d9b7dafda2..066d2f3983 100644
--- a/kernel/util/rhy.go
+++ b/kernel/util/rhy.go
@@ -17,6 +17,8 @@
package util
import (
+ "errors"
+ "fmt"
"sync"
"time"
@@ -43,11 +45,16 @@ func GetRhyResult(force bool) (map[string]interface{}, error) {
}
request := httpclient.NewCloudRequest30s()
- _, err := request.SetSuccessResult(&cachedRhyResult).Get(GetCloudServer() + "/apis/siyuan/version?ver=" + Ver)
+ resp, err := request.SetSuccessResult(&cachedRhyResult).Get(GetCloudServer() + "/apis/siyuan/version?ver=" + Ver)
if nil != err {
logging.LogErrorf("get version info failed: %s", err)
return nil, err
}
+ if 200 != resp.StatusCode {
+ msg := fmt.Sprintf("get rhy result failed: %d", resp.StatusCode)
+ logging.LogErrorf(msg)
+ return nil, errors.New(msg)
+ }
rhyResultCacheTime = now
return cachedRhyResult, nil
}