mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2025-02-23 20:52:15 +08:00
parent
3dfff84cc3
commit
14c9cf1b97
@ -98,7 +98,7 @@ func (t *DomainTrie) Search(domain string) *Node {
|
|||||||
|
|
||||||
n := t.search(t.root, parts)
|
n := t.search(t.root, parts)
|
||||||
|
|
||||||
if n.Data == nil {
|
if n == nil || n.Data == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ func TestTrie_Basic(t *testing.T) {
|
|||||||
assert.NotNil(t, tree.Insert("", localIP))
|
assert.NotNil(t, tree.Insert("", localIP))
|
||||||
assert.Nil(t, tree.Search(""))
|
assert.Nil(t, tree.Search(""))
|
||||||
assert.NotNil(t, tree.Search("localhost"))
|
assert.NotNil(t, tree.Search("localhost"))
|
||||||
|
assert.Nil(t, tree.Search("www.google.com"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTrie_Wildcard(t *testing.T) {
|
func TestTrie_Wildcard(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user