diff --git a/server/internal/library/dict/dict_option.go b/server/internal/library/dict/dict_option.go index bfebb12..b52070b 100644 --- a/server/internal/library/dict/dict_option.go +++ b/server/internal/library/dict/dict_option.go @@ -75,7 +75,9 @@ func GenHashOption(key interface{}, label string) *model.Option { tag := "default" if _, err := hash.Write(gconv.Bytes(label)); err == nil { index := int(hash.Sum32()) % len(strings) - tag = strings[index] + if index < len(strings) { + tag = strings[index] + } } return &model.Option{ Key: key, diff --git a/server/internal/library/network/tcp/msg_parser.go b/server/internal/library/network/tcp/msg_parser.go index 3df173f..d708800 100644 --- a/server/internal/library/network/tcp/msg_parser.go +++ b/server/internal/library/network/tcp/msg_parser.go @@ -89,7 +89,7 @@ func (m *MsgParser) RegisterRPCRouter(routers ...interface{}) (err error) { // RegisterInterceptor 注册拦截器 func (m *MsgParser) RegisterInterceptor(interceptors ...Interceptor) { - m.interceptors = append(interceptors, interceptors...) + m.interceptors = append(m.interceptors, interceptors...) } // Encoding 消息编码