aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ethutil/bytes.go2
1 files changed, 1 insertions, 1 deletions
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)