Skip to content

Commit 87f1fff

Browse files
author
zu1k
committed
fix null pointer bug
1 parent 49b1c69 commit 87f1fff

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

api/router.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/zu1k/proxypool/pkg/provider"
1515
)
1616

17-
const version = "v0.3.7"
17+
const version = "v0.3.8"
1818

1919
var router *gin.Engine
2020

pkg/proxy/convert.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ import (
77
)
88

99
func SS2SSR(ss *Shadowsocks) (ssr *ShadowsocksR, err error) {
10+
if ss == nil {
11+
return nil, errors.New("ss is nil")
12+
}
1013
if !tool.CheckInList(SSRCipherList, ss.Cipher) {
1114
return nil, errors.New("cipher not support")
1215
}
13-
base := ssr.Base
16+
base := ss.Base
1417
base.Type = "ssr"
1518
return &ShadowsocksR{
1619
Base: base,
@@ -23,6 +26,9 @@ func SS2SSR(ss *Shadowsocks) (ssr *ShadowsocksR, err error) {
2326
}
2427

2528
func SSR2SS(ssr *ShadowsocksR) (ss *Shadowsocks, err error) {
29+
if ssr == nil {
30+
return nil, errors.New("ssr is nil")
31+
}
2632
if !tool.CheckInList(SSCipherList, ssr.Cipher) {
2733
return nil, errors.New("cipher not support")
2834
}

0 commit comments

Comments
 (0)