mirror of
https://github.com/oneclickvirt/backtrace.git
synced 2026-11-24 23:39:41 +08:00
fix:修复panic恢复机制
This commit is contained in:
1 parent
026f9784e4
commit
ce8555f149
11 files changed
+94
-21
No files matched your search
+3
-3
@@ -47,7 +47,7 @@ func checkCdn(testUrl string) string {
|
||||
Logger.Info(fmt.Sprintf("Testing CDN: %s", url))
|
||||
}
|
||||
resp, err := client.R().Get(url)
|
||||
if err == nil {
|
||||
if err == nil && resp != nil && resp.Body != nil {
|
||||
b, err := io.ReadAll(resp.Body)
|
||||
resp.Body.Close()
|
||||
if err == nil && strings.Contains(string(b), "success") {
|
||||
@@ -92,7 +92,7 @@ func getData(endpoint string) string {
|
||||
Logger.Info(fmt.Sprintf("Using CDN: %s", url))
|
||||
}
|
||||
resp, err := client.R().Get(url)
|
||||
if err == nil {
|
||||
if err == nil && resp != nil && resp.Body != nil {
|
||||
defer resp.Body.Close()
|
||||
b, err := io.ReadAll(resp.Body)
|
||||
if err == nil && !strings.Contains(string(b), "error") {
|
||||
@@ -112,7 +112,7 @@ func getData(endpoint string) string {
|
||||
Logger.Info(fmt.Sprintf("Trying direct connection: %s", endpoint))
|
||||
}
|
||||
resp, err := client.R().Get(endpoint)
|
||||
if err == nil {
|
||||
if err == nil && resp != nil && resp.Body != nil {
|
||||
defer resp.Body.Close()
|
||||
b, err := io.ReadAll(resp.Body)
|
||||
if err == nil {
|
||||
|
||||
Reference in new issue
Block a user