From b51099544dd23a6cf9daeedc5e7e29e9c9886643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E5=89=91?= Date: Fri, 14 Apr 2023 16:34:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=B9DbClient=E7=9A=84?= =?UTF-8?q?=E7=A9=BA=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/api/api.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/api/api.go b/pkg/api/api.go index d3c178d..be62e96 100644 --- a/pkg/api/api.go +++ b/pkg/api/api.go @@ -34,7 +34,12 @@ func DB(c *gin.Context) *client.Client { if command.Opts.Sessions { return DbSessions[getSessionId(c.Request)] } - DbClient.SetApplicationName() + if DbClient != nil { + _, err := DbClient.SetApplicationName() + if err != nil { + return nil + } + } return DbClient } -- Gitee