1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-22 12:54:53 -05:00

Prevent panic on empty HOST for mysql (#11850)

Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
zeripath 2020-06-11 17:47:55 +01:00 committed by GitHub
parent a3fe9d87f2
commit 9ecf732abc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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