fix the regexps bugs

This commit is contained in:
astaxie 2014-08-11 22:40:50 +08:00
parent b5a2347e1d
commit 8ed6d06572
1 changed files with 5 additions and 1 deletions

View File

@ -106,7 +106,11 @@ func filterTreeWithPrefix(t *Tree, wildcards []string, reg string) {
filterCards = append(filterCards, v)
}
l.wildcards = filterCards
l.regexps = regexp.MustCompile("^" + reg + strings.Trim(l.regexps.String(), "^$") + "$")
if l.regexps != nil {
l.regexps = regexp.MustCompile("^" + reg + strings.Trim(l.regexps.String(), "^$") + "$")
} else {
l.regexps = regexp.MustCompile("^" + reg + "$")
}
} else {
if l.regexps != nil {
filterCards := []string{}