Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
CandyWater 2026-02-22 04:05:26 +08:00 committed by GitHub
parent 327185b6d8
commit aba983b200
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -102,7 +102,10 @@ func NewExecToolWithConfig(workingDir string, restrict bool, config *config.Conf
denyPatterns = append(denyPatterns, defaultDenyPatterns...)
}
var allowPatterns []string = config.Agents.Defaults.AllowPatterns
var allowPatterns []string
if config != nil {
allowPatterns = config.Agents.Defaults.AllowPatterns
}
var allowRegex []*regexp.Regexp
if len(allowPatterns) > 0 {
allowRegex = make([]*regexp.Regexp, 0, len(allowPatterns))