fix: check lnclient is nil in GetPermittedMethods (#2343)

this caused a possible panic on shutdown
This commit is contained in:
Roland 2026-05-14 18:37:37 +07:00 committed by GitHub
parent 162965300e
commit 55d665db74
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -61,6 +61,10 @@ func (svc *permissionsService) HasPermission(app *db.App, scope string) (result
}
func (svc *permissionsService) GetPermittedMethods(app *db.App, lnClient lnclient.LNClient) []string {
if lnClient == nil {
return []string{}
}
appPermissions := []db.AppPermission{}
svc.db.Where("app_id = ?", app.ID).Find(&appPermissions)
scopes := make([]string, 0, len(appPermissions))