From 721a681ff108fb6a1d5554d751d93ee58ffbcf94 Mon Sep 17 00:00:00 2001 From: Yang Luo Date: Tue, 30 Jan 2024 21:40:39 +0800 Subject: [PATCH] fix: improve error handling in GetUserApplication() --- controllers/application.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/controllers/application.go b/controllers/application.go index 699f0dc3..be8e51a9 100644 --- a/controllers/application.go +++ b/controllers/application.go @@ -139,6 +139,10 @@ func (c *ApiController) GetUserApplication() { c.ResponseError(err.Error()) return } + if application == nil { + c.ResponseError(fmt.Sprintf(c.T("general:The organization: %s should have one application at least"), user.Owner)) + return + } c.ResponseOk(object.GetMaskedApplication(application, userId)) }