mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-04-19 13:32:24 +00:00
fix bug for nil pointer (#2438)
This commit is contained in:
parent
0630642849
commit
e1bc43da5f
1 changed files with 4 additions and 0 deletions
|
@ -181,6 +181,10 @@ func (x *XrayAPI) GetTraffic(reset bool) ([]*Traffic, []*ClientTraffic, error) {
|
|||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
|
||||
defer cancel()
|
||||
|
||||
if x.StatsServiceClient == nil {
|
||||
return nil, nil, common.NewError("xray StatusServiceClient is not initialized")
|
||||
}
|
||||
|
||||
resp, err := (*x.StatsServiceClient).QueryStats(ctx, &statsService.QueryStatsRequest{Reset_: reset})
|
||||
if err != nil {
|
||||
logger.Debug("Failed to query Xray stats:", err)
|
||||
|
|
Loading…
Reference in a new issue