diff options
| author | Paul Buetow <pbuetow@mimecast.com> | 2020-09-11 14:55:50 +0100 |
|---|---|---|
| committer | Paul Buetow <pbuetow@mimecast.com> | 2020-09-11 14:55:50 +0100 |
| commit | cdbcef72a1b9f93d08455b5a77f7f7afa2b9f53d (patch) | |
| tree | 36e4353ec640eeaee590a6e36a892cfd02e8d512 /internal | |
| parent | ec67d9833095dfbe620dd3c99ea0caba391c4b87 (diff) | |
fix nil pointer panic
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/clients/maprclient.go | 2 | ||||
| -rw-r--r-- | internal/regex/regex.go | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/internal/clients/maprclient.go b/internal/clients/maprclient.go index 581db44..149129d 100644 --- a/internal/clients/maprclient.go +++ b/internal/clients/maprclient.go @@ -123,7 +123,7 @@ func (c MaprClient) makeCommands() (commands []string) { commands = append(commands, fmt.Sprintf("timeout %d %s %s %s", c.Timeout, modeStr, file, c.Regex.Serialize())) continue } - commands = append(commands, fmt.Sprintf("%s %s regex %s", modeStr, file, c.Regex.Serialize())) + commands = append(commands, fmt.Sprintf("%s %s %s", modeStr, file, c.Regex.Serialize())) } return diff --git a/internal/regex/regex.go b/internal/regex/regex.go index 707cb48..f668c38 100644 --- a/internal/regex/regex.go +++ b/internal/regex/regex.go @@ -39,6 +39,10 @@ func New(regexStr string, flag Flag) (Regex, error) { } func new(regexStr string, flags []Flag) (Regex, error) { + if len(flags) == 0 { + flags = append(flags, Default) + } + r := Regex{ regexStr: regexStr, flags: flags, |
