handles 0 length tokens correctly

Without this nats-req '$JS.TEMPLATE..DELETE' '' causes a panic
This commit is contained in:
R.I.Pienaar
2020-01-29 12:59:21 +01:00
committed by Derek Collison
parent 7ee7c19fc7
commit dc207be04f

View File

@@ -1190,13 +1190,12 @@ func isSubsetMatch(tokens []string, test string) bool {
return true
}
t1 := tokens[i]
l = len(t1)
if l == 0 {
return false
}
if t1[0] == fwc && l == 1 {
if l == 0 || t1[0] == fwc && l == 1 {
return false
}
if t1[0] == pwc && len(t1) == 1 {
m := t2[0] == pwc && len(t2) == 1
if !m {