Check if the string is empty.

This commit is contained in:
Miek Gieben 2014-01-18 22:02:49 +00:00
parent b0c068e420
commit e78a7436aa
1 changed files with 3 additions and 1 deletions

View File

@ -10,10 +10,12 @@ package dns
// www.miek.nl. returns []string{"www", "miek", "nl"}
// The root label (.) returns nil.
func SplitDomainName(s string) (labels []string) {
if len(s) == 0 {
return nil
}
fqdnEnd := 0 // offset of the final '.' or the length of the name
idx := Split(s)
begin := 0
if s[len(s)-1] == '.' {
fqdnEnd = len(s) - 1
} else {