Just make len 0 a special case
diff --git a/homedir.go b/homedir.go
index 3621a70..b6d3502 100644
--- a/homedir.go
+++ b/homedir.go
@@ -26,7 +26,11 @@
 // is prefixed with `~`. If it isn't prefixed with `~`, the path is
 // returned as-is.
 func Expand(path string) (string, error) {
-	if len(path) == 0 || path[0] != '~' {
+	if len(path) == 0 {
+		return path, nil
+	}
+
+	if path[0] != '~' {
 		return path, nil
 	}