From a98e35d7a048850fb77fad49fff7364cf77a9bae Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 28 May 2014 13:55:32 +0200 Subject: [PATCH] Length checking --- ethutil/bytes.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethutil/bytes.go b/ethutil/bytes.go index 075e40b4c..1c7a43af8 100644 --- a/ethutil/bytes.go +++ b/ethutil/bytes.go @@ -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)