Matcher checks nil receiver

This commit is contained in:
Audrius Butkevicius
2015-04-27 20:49:10 +01:00
parent 50d377d9fe
commit 77a161a087
3 changed files with 12 additions and 7 deletions

View File

@@ -95,6 +95,10 @@ func (m *Matcher) Parse(r io.Reader, file string) error {
}
func (m *Matcher) Match(file string) (result bool) {
if m == nil {
return false
}
m.mut.Lock()
defer m.mut.Unlock()
@@ -128,6 +132,10 @@ func (m *Matcher) Match(file string) (result bool) {
// Patterns return a list of the loaded regexp patterns, as strings
func (m *Matcher) Patterns() []string {
if m == nil {
return nil
}
m.mut.Lock()
defer m.mut.Unlock()