Fix nil config provided

fix-nil-config
风扇滑翔翼 2025-09-18 06:42:23 +00:00 committed by GitHub
parent fe57507fd9
commit 15174a8dc6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -71,6 +71,9 @@ type handlerServer struct {
}
func (s *handlerServer) AddInbound(ctx context.Context, request *AddInboundRequest) (*AddInboundResponse, error) {
if request.Inbound == nil {
return nil, errors.New("inbound config is nil")
}
if err := core.AddInboundHandler(s.s, request.Inbound); err != nil {
return nil, err
}
@ -163,6 +166,9 @@ func (s *handlerServer) GetInboundUsersCount(ctx context.Context, request *GetIn
}
func (s *handlerServer) AddOutbound(ctx context.Context, request *AddOutboundRequest) (*AddOutboundResponse, error) {
if request.Outbound == nil {
return nil, errors.New("outbound config is nil")
}
if err := core.AddOutboundHandler(s.s, request.Outbound); err != nil {
return nil, err
}