Length checking

This commit is contained in:
obscuren 2014-05-28 13:55:32 +02:00
parent 65722aeeca
commit a98e35d7a0
1 changed files with 1 additions and 1 deletions

View File

@ -90,7 +90,7 @@ func IsHex(str string) bool {
}
func StringToByteFunc(str string, cb func(str string) []byte) (ret []byte) {
if str[0:2] == "0x" {
if len(str) > 1 && str[0:2] == "0x" {
ret = FromHex(str[2:])
} else {
ret = cb(str)