From 457d855107c8fa099db157973217c48c29825f69 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Wed, 24 Jan 2024 20:50:58 +0330 Subject: [PATCH] [bug] avoid empty inbound Co-Authored-By: Alireza Ahmadi --- web/service/inbound.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/web/service/inbound.go b/web/service/inbound.go index 2a4966ab..f3445101 100644 --- a/web/service/inbound.go +++ b/web/service/inbound.go @@ -317,7 +317,6 @@ func (s *InboundService) UpdateInbound(inbound *model.Inbound) (*model.Inbound, oldInbound.Tag = fmt.Sprintf("inbound-%v:%v", inbound.Listen, inbound.Port) } - needRestart := false s.xrayApi.Init(p.GetAPIPort()) if s.xrayApi.DelInbound(tag) == nil { @@ -509,6 +508,10 @@ func (s *InboundService) DelInboundClient(inboundId int, clientId string) (bool, } } + if len(newClients) == 0 { + return false, common.NewError("no client remained in Inbound") + } + settings["clients"] = newClients newSettings, err := json.MarshalIndent(settings, "", " ") if err != nil {