summaryrefslogtreecommitdiffstats
path: root/modules/setting/database.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-06-11 17:47:55 +0100
committerGitHub <noreply@github.com>2020-06-11 12:47:55 -0400
commit9ecf732abc43f4201a7fb101c2e54ea484d8f20a (patch)
treeb342f606de6e7c7f3a0e0cd6bc40a5066571eb29 /modules/setting/database.go
parenta3fe9d87f2a7c7c9b5d5f5f5351e3c6c70aaf9fe (diff)
downloadgitea-9ecf732abc43f4201a7fb101c2e54ea484d8f20a.tar.gz
gitea-9ecf732abc43f4201a7fb101c2e54ea484d8f20a.zip
Prevent panic on empty HOST for mysql (#11850)
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'modules/setting/database.go')
-rw-r--r--modules/setting/database.go2
1 files changed, 1 insertions, 1 deletions
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