From 9ecf732abc43f4201a7fb101c2e54ea484d8f20a Mon Sep 17 00:00:00 2001
From: zeripath <art27@cantab.net>
Date: Thu, 11 Jun 2020 17:47:55 +0100
Subject: [PATCH] Prevent panic on empty HOST for mysql (#11850)

Signed-off-by: Andrew Thornton <art27@cantab.net>
---
 modules/setting/database.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/setting/database.go b/modules/setting/database.go
index 6bfb02ac41..4e84f8f8d1 100644
--- a/modules/setting/database.go
+++ b/modules/setting/database.go
@@ -105,7 +105,7 @@ func DBConnStr() (string, error) {
 	switch Database.Type {
 	case "mysql":
 		connType := "tcp"
-		if Database.Host[0] == '/' { // looks like a unix socket
+		if len(Database.Host) > 0 && Database.Host[0] == '/' { // looks like a unix socket
 			connType = "unix"
 		}
 		tls := Database.SSLMode